Viewers: in countries Watching now:
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 offers another feature for managing your code, where you want to use the code over and over again. It's called the Snippets panel, and it's been a part of Dreamweaver for quite a while. For this exercise, I'll use the version of my site in the folder 03_managingcode\06_snippets. The Snippets folder is located in the same panel group as the Files panel. It's populated with some default snippets, including commenting, footers, form elements, and many others, but you can add your own snippets quite easily.
For this exercise, I'll start with the file footer.php that's in the _includes folder of my site. I'll look at the file in Code View in fullscreen and scroll down to the dateutil section. I'm going to take a few elements of this php code and make them into a reusable code snippet. I'll start with the PHP Include command up at the top. I'm going to move the code around a little bit to get the code ready to use in a code snippet, but I won't save the changes to this file; I'm only going to use it as a resource.
I'll first select the include command from the first php code block, and I'll copy it to the clipboard. Then I'll go down to the other php code that's calling the DateUtility class. I'll place the cursor within the php code block and press Enter, and then paste in the Include command. Then I'm going to change the indenting of this code. I'll select the entire code block and then press Shift+Tab until all of the code is aligned left in the page.
The purpose is just to strip out all the tabs before I create the snippet. I'll leave the code selected, and I press F4 to show my panels again. Then I'll go to the Snippets panel. Within the Snippets panel, you can add a new snippet to any of the existing folders, or you can create your own folder. I'll right-click in the panel, but not on any of the folder icons, and choose New Folder, and I'll name my new folder PHP. Then I'll right-click again and choose New Snippet.
The code that I'd already selected in the editor area is automatically copied into the snippet dialog. You can also manually copy and paste, if you like. I'll name my new snippet Get Current Time. You can select your snippets to one of two types. If you choose Wrap selection, you'll be inserting code before and after selected code. If you choose Insert block, that means you're inserting all of the code as a single block. That's the type that I want to use.
In the Description, you can type in anything you want. I'll type in, "Use my custom DateUtility class" and click OK. Anytime you want to use that code, you'll have it available in your Snippets folder. I'll go back to footer.php, I'll go back to the top of the page, and I'll remove the php code block at the top, and I'll go down to the bottom and remove that php code block as well. Now, in the future, if I want to use the snippet, all I have to do is make a little bit of space, then go to the Snippets panel and then double-click the snippet, or drag it where I want it to go.
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.