Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
What we need to do is click on the Server Behavior panel, so you can see we already have some server behaviors on our page, just dragging dynamic text to the page, or binding attributes, or even developing a recordset like we have done. Since that is putting applications server code on our page, it's going to appear in the Server Behaviors panel. So let's click anywhere inside our artists description, anywhere inside it, it doesn't matter where. And if you look at the Tag Selector, you can see that you are inside of a div tag with the class of artist, and that's whom we're really going to focus on. So go ahead and use your Tag Selector to click on the div.artist tag.
Now this div tag is encasing all of the components of our artist description, so our first name, our last name, the photo, all inside this div tag. When you do a Repeat Region, you want to make sure that you have the element selected that needs to repeat. So we don't want to highlight inside the div tag because these elements would just repeat over and over and over inside the div tag. By choosing the div tag, the div tag itself will repeat over and over and over again for as many items as you tell it to from the recordset. So let's go ahead and apply our Server Behavior. I am going to go up to the plus symbol in the Server Behavior panel, and one of the first options right there is Repeat Region. So I am going to choose Repeat Region, and that brings up the dialog box and it's asking me which recordset do you want to use? Well, we only have one right now, which is rsArtists.
Now notice that we can show a certain number of records at a time. That's really helpful if you are doing searches and you've got a lot of data and you might not want to display it all on the page at one time, you can say just display ten records at a time, and you can actually build page sets so they can page to your data. Well, we are going to go ahead and say All records because we want all of our artists to display. So I'll go ahead and click OK. You can actually see around our div tag a tab area that says Repeat. I want to take just a moment to look at the Code view for this. So I am going to switch to Code view, and I am going to scroll down and you can see a lot of PHP code.
Now, if you don't know PHP, don't worry about it at all. You don't have to know PHP. That's the beauty of using Dreamweaver to do Dynamic Development. So we are going to go ahead and choose Save and we are going to test this in our browser. Once again it's going to ask you, if you want to update your copy on the testing server, I am going to say OK. Now I am not going to put the dependent files, we did it last time and I haven't really changed in the asset file, so I am just going to choose No there. And it will preview it in our browser and now if I scroll down, look how much work we saved to ourselves. We don't have to worry about hand coding all these, or building them on. We don't even have to build this from a template.
We are going ahead and let the database take care of this, and that is the beauty of using Dynamic Development in your workflow. It just really speeds up the process. Now everything here looks great, but there is one problem. If I click on the Bio page for Dan keys, I am still going to Aimee's Bio page, and if I click on Dan's Gallery, I am still going to Aimee's Gallery. And as nice as Aimee's gallery is, that is not what we want to have happened. So what we'll do now is we'll go back in the Dreamweaver and we are going to go ahead and modify those links, so that a portion of them are dynamically generated and they'll link to the correct page. So let's go and close out of Firefox.
And I am initially going to switch back to the Design view but we are going to perform this in Code view. So I am going to go ahead and highlight the Gallery page link, and I'll switch over in the Code view. That's a real quick and easy way to find your way around in your Source code so that you don't have to do a lot of scrolling. Okay, well if I am looking at line 76, here is the link tags. So I am just going to go ahead and highlight that so that you guys can see this. And we see we have the Well, one of the things that we did when we were building our database. And I am going to click back to the Bindings panel so that we can see this is-- we have see this element in our recordset called shortName, and shortName contains the first name of the artist and we did some prior planning and all of our links to our banner images, and to our bios page, and to our gallery page, they just use that first name. So I can actually just highlight the name in the link. Now, notice that I am not highlighting the whole link. I am just highlighting just the name.
I can actually go and grab the shortName from the recordset, and I can drag-and-drop that on the page. And it's going to go ahead and insert some server-side code here. Now this may seem kind of foreign to you, so let's take just a moment to examine the statement that was placed on the page. So we have a PHP tag and notice that we have the question mark at the beginning of the tag and at the end of the tag, and that indicates PHP content. Then we have echo, an echo in PHP is just telling the server to write something on the page. So we have our recordset, rsArtists, and notice that it's pulling from the recordset, shortName.
Now we're actually going to go ahead and do the same thing for the gallery. So on the same line, I am going to go ahead and highlight the name aimee there as well. I am going to go back and grab shortName again, and I will just drag-and-drop right over the highlighted text, and there is my PHP code. Now, you should always sort of double- check to make sure that replace just the code that you had highlighted. You want to make sure that no extra space is replaced in there, or a Period or a Quotation Mark is not out of place because it is that's going to cause some serious problem. So I will save this again, and we will test this in our browser one more time, and I am going to go ahead and update that on the server as well.
Again I am going to choose No on to put dependent file, unless those really change there is no reason for me to do that. Okay, we are seeing our repeating list of artists again and let's say I click on Chris' Gallery, and right here we have Chris' Gallery. I hit the Back button and scroll down a little bit further and I click on Greg's Bio and I get Greg's Bio. So now you can see all of our links are working, and they are doing exactly what we expected them to do. And we are doing that to the use of dynamic text.
So again dynamic development is saving us a lot of time. So we can see how easy it is that. Once you have your database set up, putting this information on the page and making it display the way you want to is fairly simple. In our next exercise, we are going to explore the concept of filtering data. Only showing data when certain criteria are met and we'll also explore the concept of passing information from one page to another.
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.
Your file was successfully uploaded.