Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
The last modification we want to make to our artist page is to make the list of links to our Bio page, dynamic. Currently they appoint to the old static pages and it would be too time consuming to redo them by hand. What's more, the artist listing on a page is dynamically generated. And our navigation would not respond to an artist being added or removed from the database. So it is a good idea to go ahead and make them dynamically generated as well. So to do that, we are going to go ahead and highlight all of our Bio links except for one and that would be Aimee because she is always on the top of the list. And we will just go ahead and delete them all. So make sure you go ahead and get rid of all of them except for the last one. And we certainly have enough information in our old recordset to populate this, but we are going to go ahead and generate a new recordset that's a much more paired down SQL Query.
So we are going to get to our Bindings panel and choose recordset and we are going to create a new recordset called rsNav. We will use the dsArtists Connection. So the more you do this, the more comfortable you get with this dialog box and you start moving through it pretty quickly. So, for columns we are going to choose Selected instead of All and we are going to choose id. We need to pass that into the Bio page of course. We will do our firstName and our lastName that's going to help us build the link and that's really all that we need. We can also go ahead and sort them if we would like and we will just go ahead and sort them by first name just like everybody else is doing and we will go ahead and remember to test our recordset before we try to use it on the page and we are seeing that there is everybody's name and there is the id and that's all we need for our navigation menu so we will click OK and click OK again.
So, now in this page we have multiple recordsets. Nothing wrong with that; you can have as many of this queries as you like. So we will go ahead and highlight Aimee's first name and making sure that we are working from the rsNav recordset and one of the things I would like to do to ensure that is close all the recordsets that I am not currently working with, because it's really easy. A lot of times you will see first name and just go ahead and start to use it, but it's from the wrong recordset. So make sure you are doing rsNav. I will select first name and we will go ahead and insert that and I will select the last name and we will go ahead and insert that. Now our link is still pointing to the Aimee Bios page, so I am going to click inside the link anywhere to click on the link tag. I will go to my Properties inspector and bringing the Properties inspector to the forefront again. Just like the last time I am going to click on the Browse for File. So this is very similar to what we have just accomplished with the link to our Bio page.
So we will click on the bio.php. I will click on Parameters and once again we are going to pass in artistID and again the value clicking on the dynamic link is going to the recent id. Once again make sure you are working from the correct recordset or in the rsNav and we will choose id. Because the current ID and rsArtist might not match up the one in rsNav so you got to make sure that you are using the right recordset. So we will click OK and choose or select to go ahead and close all that.
Now, as we experienced, when we first build this page right now if we were to preview this we would only see the link to our first artist and we want this link to go ahead and build out. So we are going to use the technique that we used earlier which is the Repeat Region. Now one of the tricks of using a Repeat Region is to understand which element should repeat. And it might be tempting to repeat the A tag but we are in an unordered list. So if we do that we are just going to get numerous link tags inside of a list item tag and that's really not what we want. So we want build this out as a list, so in my Tag Selector, I am going to find a list item tag just to the left of the A tag and I am going to select that. So we want to make sure that we have the list item element selected. I will go to my Server Behaviors panel because that's where we are going to do our repeat region and now we can see that we have a lot of stuff going on in the page. So I am going to click the Plus button and once again I am going to choose Repeat Region.
So, I need to know which recordset I am using and I am going to use rsNav and again I am going to display all my records. So we are sorting them by first name we, are displaying all the records and we are pulling that from rsNav. So we will click OK, save the page and we will go ahead and preview that in our browser. Now this time I do want to update the file in the testing server so I will say Yes. I don't need to put the dependent files, so for that I will say No. And we should see our finished artist page.
So there is our list of links for the Bios page you can see that's being built dynamically from the database. Visually it's no different from what we see on the Galleries page, which is still static. So let's see if it works, if I click Bios, I go to Aimee's Bio and if I click Joe's Bio I go to Joe's Bio, fantastic. So it's working exactly the way that we expected. So if you want to take this exercise a bit further you could try to build out the Galleries page as well and that's going to require you to go through some of the same steps again and may be even think about making the Gallery page itself dynamic to complete the entire cycle. I hope that these exercise have gotten you excited about what dynamic development it can add to your site in terms of interaction and save development time. If you want to learn more, check out the lynda.com Dreamweaver CS3 Dynamic Development title.
Get unlimited access to all courses for just $25/month.Become a member
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.