Start learning with our library of video tutorials taught by experts. Get started
Viewed by members. in countries. members currently watching.
Covering diverse topics such as improving workflow and managing CSS styles, Dreamweaver CS3 Beyond the Basics is a hands-on course that teaches users how to move beyond standard, static websites. Instructor James Williamson explores how to increase productivity, interactivity, and accessibility with Dreamweaver. He also discusses how to extend the application's capabilities with XML and XSL. Exercise files accompany the tutorials.
So we are back working on our bio page and we are going to replace the markup information on the page with our dynamic data, and we're not really doing anything new here yet, but we are going explore a new concept on this page known as Live Preview. When you are working with Filter data, the way we are on this page, a lot of times you are going to want to test that locally and this could be very hard to without passing a parameter into this file. So testing it on the server-side would be kind of difficult since we don't have a default parameter. So I am going to show you how to test it locally and use Live Preview.
So before we do that, let's go up and start working on replacing our data and we are going to go all the way up to the very top because we need to figure out what's going to change on this page for each artist. And the first thing and the thing that a lot of people forget about is the title of the page. So the title of the page is Aimee Hutchins Bio and that is not going to work for us. So I am going to switch to Code view and find the title tag, which is on line 46, and I am going to highlight Aimee's name. And I don't really have a single artist's name. I've got a firstName and a lastName. Now that allows me to be very flexible, but I also have to be careful about that.
So I really just need to go ahead and highlight Aimee's first name and then select firstName and drag it over Aimee and then I need to highlight the last name and drag that over Hutchins. Now again, I want to make sure that I have got space between the two of them so it gets really kind of confusing in Code view. I just want to make sure I've got enough space between the first PHP and the second PHP. I don't want the first and last name to sort of jam together. And that takes care of our title. So I am going to switch over to Design view and in Design view the banner graphic at the top of the page is unique to each artist as well.
So we could make that a dynamic image but our database really doesn't have anything in it for a banner graphic. We have a small image and a large image, but we don't have the path or a banner graphic, so you're not always going to have everything you need inside of your database. But again the naming convention that we used for almost all of the things that are going to change on a page-- So if you select it you can look at the source of the file and you see that it says aimee_banner. Well, the shortName in our recordset is actually the first name of each artist. So once again I am going to switch over to Code view after selecting the banner graphic, and in the image source I am going to highlight the word aimee and once again I am going to go to the shortName and drag that over in its place.
I will need to do the same thing for the alt text and in the alt text I am going to use the shortName as well, right there. So now we have our shortName concatenated into the source attribute and we have the shortName being used for the alt tag. So we'll flip back over into the Design view and you will notice now that our banner graphic is gone and it's replaced with a dynamic link. So Dreamweaver is very well aware of the fact that that image is relying on dynamic data to display. We are going to place Aimee's name in the headline next. I will highlight Aimee and I am going to choose firstName and click Insert and it will insert it on the page.
I will highlight Hutchins, choose lastName, insert that on the page, and you can see I am trying to go in a very deliberate order down the page. I am going to select the photo of Aimee. We need to bind the source of that to the small image. So once the image is selected I am going to go over to my recordset. So this is really good practice for us to do this again. I am going to click on small image and notice that the default is to bind to the image source, so I am going to verify that,it says image source in my pulldown menu and choose Bind. And I am also going to -- with that still selected -- I am going to the shortName and I am going to bind that as I grab the pulldown menu to the image alt attribute. So make sure again in the Bind To menu it says img.alt. Make sure shortName is selected in your recordset and click Bind. We are almost done.
I am going to scroll down and highlight all of the dummy text where our bio is going to go. So we will highlight that, and I will go over to my Bindings panel and click on the bio item from our recordset and then click Insert. That will replace that. Now I mentioned before that we are going to place a larger image on the file, just a representational image of the artist's artwork. So after the bio I am going to place my cursor right at the end of that recordset detail, and I will hit Enter and that will take me down to the next line. And on the next line I am going to choose the large image. Now if I click Insert on the page or drag it to the page then it isn't going to work for me because it will end up displaying the actual path to the image on the page as text and that is not what we want.
So we've got to figure out how to get this image on the image. Now you could put a placeholder graphic on the page and change the source binding, which we have been doing up until now, but there is actually a much easier way. I am going to go to the Common Objects and I am going to go to the Images pulldown menu and I am going to select Image. So if I click on my Images directory and I start browsing around, I don't see anything in here that says Dynamic image for artist. So that is not what I need. So in my Select Image Source dialog box, at the very bottom on the Mac I see a button down here that says Data Sources. Now on the PC that button is actually going to be the top of the dialog box. So I am going to click on Data Sources and I am going to choose lgimg and that contains the path for the image, and if I need to do any special formatting and usually this is for like form data or things like that, I could do that, but I don't need that so I am going to click OK.
And again it's asking me for an alternative text. I don't really have any alternative text right now and it doesn't matter because I can't bind it here anyways so I am going to click OK and there is my image. Now the next thing I am going to do I do need to alt tag this. So with that image selected I will go over to my recordset, click on shortName and choose once again img.alt. And we'll choose Bind. Now there is one thing we need to do here in terms of cascading styles. In this particular div tag all the images are being told to float to the left and it would be disastrous to our page design if this were floating to the left. So go ahead and select the image and in the Properties inspector from the Class pulldown menu, go ahead and choose nofloat. That's the class we have already created, and that's going to make sure that that image appears all by itself.
So there's nothing wrong with combining dynamic data and cascading style sheets. It actually makes for a very efficient way of working. So we've only got one element left on the page to deal with and that is the link to Aimee's Gallery. Now when you're typing this by hand it makes sense to say Aimee's Gallery and Ben's Gallery and that sort of thing, but we have a little bit of a problem and that's that we're going to be displaying these names dynamically. So you really don't know whose name is going to show up. So if we change Aimee and Ben and William and Josh, it's going to be just fine, but what happens when we say display Chris's Gallery. Well, Chris doesn't need an apostrophe S. So that would be grammatically incorrect.
Now we could go so far as to write regular expression in the PHP. That would say okay, if the name end in S take off the last S and just leave the apostrophe, but that's a little bit of work. So what we are going to do is we're just going to modify our gallery altogether. What we are going to do is I am going to come in and highlight the text and we're just going to replace Aimee with Artist Gallery and after the Gallery we're just going to type in a colon. That will be good. And we'll just type in placeholders for First Name and Last Name. So we'll have a nice long link here.
So now we need to replace our placeholders in here with dynamic data. So we could highlight text First Name and go up to firstName and insert that. And we could highlight Last Name, highlight Last Name and insert that. Now the problem is the link's going to look just fine but where is it actually going to go? Well, I'll need to switch back to Code view and in Code view on line 72 I can see there is my a href and it's still going to aimee.htm.
So I need to highlight that and we are going to use our shortName to drag that over the word aimee to replace that. So once again, make sure that your PHP is exactly where it needs to be. That you'll have any extra spaces or anything that might cause the link not to work. So we will back to Design view and we will save the file. Now, I love to be able to preview this in my browser, but if I tried I would get an error and the error is-- the error would be caused by the fact that this page is expecting a parameter to be passed into it. So if you don't pass a parameter into it, it doesn't know which records to display. So I am going to scroll back up the top so we can see this when we do preview it. And what's nice about Dreamweaver is Dreamweaver gives us the ability to preview this data live, and if you look at your Document toolbar where your Code, your Split and your Design view buttons are, you can see there is a new little icon there and if I hover over it says Live Data view.
Now when you're developing, especially if you are dealing with really large scripts sometimes previewing that in your browser is going to take a while or you might have to upload a lot of files. So sometimes you just want to check and make sure that that data is showing up on the page the way you expect. So I am going to go ahead and click that. So we're actually not seeing any data on the page at all. And the reason for that is because again we have not passed a parameter into it, but after we click on the Live Data view, underneath that we see an address bar and just to the right of the address bar is an area for us to pass in a parameter. So I am going to go ahead and type in artistID= and we'll just go ahead and choose 3.
If you hit Enter and nothing happens, go over to the left and click on the Refresh Live Data. You could see the shortcut key for that is Ctrl+R or Command+R, so we'll click on that and there is our Live Data. So we can see the banner graphic for Chris coming in. We can see Chris' name, his photo, we've got the bio page, there is a large image appearing where we expect it to and here's our link to the Artist's Gallery, Chris Mattia. So that worked perfectly. Fantastic! So I am going to go ahead and turn Live Data view off again, and we go back, scroll up, go back seeing our placeholder information.
So our bio page is finished. All that's necessary now is that we complete the link in our artists page and pass over the URL parameter that identifies the artist and we will take care of that in our next example.
Find answers to the most frequently asked questions about Dreamweaver CS3 Beyond the Basics.
Here are the FAQs that matched your search "":
Sorry, there are no matches for your search ""—to search again, type in another word or phrase and click search.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.