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.
Now that we have our database defined, let's look at taking advantage of dynamic content. Currently we have one artist page that should list all of our artists. So if you are following along in the example files with me, go ahead and open up the artist.php found in your example files. If I scroll down I see a listing of one artist and we have Aimme's name, we have a short default description text, an image, and then links to her bio page and her gallery page. Well, since we have all of our artists stored within a database, it would be really nice if we could go ahead and populate all of this information from our database without having to do it manually. So our first exercise would be to go ahead and populate this list using our database.
To use our database information we'll need to have a recordset and we built our recordset in our Bindings panel in the Application panel group. So if you have your Application panel group open, just click on your Bindings panel. If you don't, you can go to Window and you can choose Bindings right there. So a recordset really is just a SQL query that's going to go out to our database and pull specific information in. This could be every bit of information from our database or we could limit the amount of information that we need for that specific recordset.
So we're going to go to our Bindings panel and click on the plus symbol and we're going to choose from the very top, recordset (Query). So I'll go ahead and choose that. So we have our recordset dialog box up and this is what we use to go ahead and define our recordsets. Now, recordsets are really just SQL queries. So what we are doing here is having Dreamweaver go ahead and write the SQL query for us itself and in this particular version of the recordset dialog box, it can create fairly simple SQL queries. If you need anything more advanced than one table or two tables, you'll click on the Advanced button and you can use some of its more advanced tools or even hand code the SQL query yourself.
So the first thing that we'll need to do is go ahead and establish our recordset name. So I am just gong to call this rsArtists and notice that I am using a prefix of rs. It's not required, but it's a good idea to go ahead and use ds for data sources and rs for recordsets and that sort of thing. So Connection, I am going to go ahead and choose dsArtists and notice that it goes in and populates using the artist table. There is only one table in this database, so if there were multiple tables I would have a pulldown menu and I'd be able to select from multiple tables, but we just have the artists table.
Now next we can choose to bring in all the information from that table or just selected info. I want to filter this out because our artist preview listing that we're going to create doesn't require all the data in the database. So I can go through now and select just the data I need. So I am going to select id and then firstName and lastName, and you might want to hold either the Command or if you're on the PC the Ctrl key down so that you can select non-contiguous items in case you run into something you don't really need. We're also going to need shortName. We will need tagline. We will not need bio. We don't need that, so we're going to leave that alone. We will need the small image, we don't need the large image and we also don't need the image caption.
So we're going to leave behind the bio, the large image and the image caption. Now most of these are pretty self- explanatory except for id. Id is a unique identifier. Each artist has their own unique number in the database and we can use that to identify that artist if we're ever linking to a page where we need to pass in information about just that particular artist. Now, you'll notice that we have another pulldown menu for filtering our information and sorting it. We don't necessarily want to filter our information. We just want to bring in everything. We don't really need to put any conditions on what we bring in, but for sorting we do want to sort.
So I am going to sort this by firstName. Since all of our links in our site sort our artists by first name, we're going to do that and we'll choose ascending. Now we could go ahead and click OK, but it's a good idea to go ahead and test any recordset that you create while you're still in the recordset dialog box. So I am going to choose test and I get to test MySQL statement and I can see that Aimme's name is first and so that is in alphabetical order, exactly the way I was hoping. You can also see their id right over here as it corresponds to their space within the table. There is our lastName, our shortName, our tagline and our small images. So notice that we don't see any bio or large image or caption information. So I am going to click OK and finally OK.
Now it may take a moment. In the Bindings panel you're going to see a new icon for our recordset. I am going to expand that and I can see inside that I have access to the id, the firstName, lastName, shortName, tagline and small image. So now that we have defined our recordset, we can go ahead and display this information on the page and that's what we're going to do in our next exercise.
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.