Start learning with our library of video tutorials taught by experts. Get started
Viewed by members. in countries. members currently watching.
Join author David Gassner as he describes how to add dynamic data to a PHP-enabled web site in Adobe Dreamweaver. This intermediate course shows how to plan and create a MySQL database, define a PHP-enabled site in Dreamweaver, connect the site to the database, and manage and present dynamic data. David also explores Dreamweaver features such as PHP custom class introspection and site-specific code hinting as well as the differences between the CS5 and CS6 versions of the software.
This course was updated on 6/12/2012.
Dreamweaver CS5 has server behaviors that let you output code conditionally. There are six options for conditional code built into Dreamweaver CS5, and you can learn from the generated code how to write your own conditions. For this demonstration, I'll use the file tours3.php. It's in the root folder of my current web site. In a previous video, I described how to limit the number of records that were being shown in a particular data set, and then how to add hyperlinks that let the user page through the data set.
I'll open the file in a browser, first copying it over to the web site, and then show that I can click through the Next and Previous, but also show you that, for example, when I'm on the First page, I still see links for First and Previous, and these links don't do anything. And if I'm on the Last page, I still see links for Next and Last. Similarly, I would like to hide those in this condition. So, I'll close the browser and return to Dreamweaver.
First, I'll deal with the condition for the First and Previous links. I'll click and drag to select those links. Then I'll go to the Server Behaviors panel, I'll click the Plus button, and I'll go to Show Region. Here are the six available server behaviors for a conditional code. You can show code if the recordset is empty or not empty, if you're on the first page or not the first page, or if you're on the last page or not the last page. I'm going to select Show if Not First Page, and then make sure that I've selected rsPackages - it's the only available choice - and click OK.
So now, those links will only display if I'm not on the first page of data. Now I'll do the same thing for the Next and Last links. I'll click and drag to select those links, I'll go to Server Behaviors, I'll click the Plus button and choose Show Region, and I'll select Show if Not Last Page, and once again, I'll click OK in the dialog box. Here's what the generated code looks like. The hyperlinks have been wrapped in if clauses.
That examines the current page number of the recordset and compares it to the total number of pages. So, now I'll test the code in the browser. I'll go to Firefox, updating the file on the server, and in the initial display, I see links for Next and Last. If I click Next, I see all four hyperlinks, because now I'm on the middle page. And when I click Last, that takes me to the last set of data and hides those links because they're no longer appropriate.
Now, I'll go Previous. I'll see all four links. I'll click Previous again, and now I'll only see the first two links. So, conditional code is something that's very easy to generate in Dreamweaver. The code itself is a little bit on the complex side, but by using Dreamweaver server behaviors, you save yourself an enormous amount of time, and get a very common behavior that users appreciate.
Find answers to the most frequently asked questions about Dreamweaver with PHP and MySQL.
Here are the FAQs that matched your search "":
<?php include('../ZendFramework/library/Zend/Date.php'); ?
<?php echo $_SERVER['DOCUMENT_ROOT']; ?
You can then programmatically modify the include_path variable at runtime with the set_include_path() function. For example, if your physical root folder is /home/myroot, the code might look like this:
<?phpset_include_path('.' . PATH_SEPARATOR .'/home/myroot/ZendFramework/library/Zend');include('Date.php');?
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.