Working with Dreamweaver MX for PHP Development

Team-Fly    

Macromedia® DreamWeaver® MX Unleashed
By Matthew Pizzi, Zak Ruvalcaba
Table of Contents
Chapter 24.  PHP and MySQL


Dreamweaver MX has two capabilities that make working with PHP more productive:

  • Tag Chooser

  • Code Snippets

The Tag Chooser

Dreamweaver MX's Tag Chooser can help you insert well-formed PHP tags in your documents.

You can access the Tag Chooser by clicking the Tag Chooser button on the toolbar or by right-clicking inside your Dreamweaver document and choosing Insert Tag from the pop-up menu.

When the Tag Chooser is open, double-click the PHP folder. You have two choices: expressions and scriptlets.

If you select expression, the Tag Chooser inserts the following PHP code into your document:

 <?php echo ?>  

If you select scriptlet, the Tag Chooser inserts the following PHP code into your document:

 <?php ?>  

You can then insert your code in between the start and end tags.

Figure 24.2. Using the Tag Chooser to select a PHP expression.

graphics/24fig02.jpg

Saving Code Snippets

Dreamweaver MX allows you to save any content, HTML markup, or PHP code as code snippets that you store in the Snippets library.

To save a piece of PHP code as a snippet, follow these directions:

  1. Highlight the PHP code you want to save as a snippet.

  2. Click the Snippets tab under Code in the right pane.

  3. Click the Create New Folder icon.

  4. Name the new folder PHP Snippets.

  5. Double-click the folder to open it.

  6. Click the Create New Snippet icon.

  7. In the Snippet dialog box, give your snippet a name that's descriptive of the code.

  8. Optionally, provide a description of the code.

  9. Choose Insert Block (this works for most PHP code blocks) instead of Wrap Selection.

    NOTE

    Wrap Selection is used to wrap code before and after any selection you've highlighted with the mouse. It's a handy way to wrap <b> and </b> tags around a word you've highlighted, but it isn't very useful when you're inserting PHP code.

  10. Choose Code as the Preview Type.

  11. Click OK to close the dialog box.

To use a code snippet, click where you want the Snippet to go and then double-click it from the list of snippets. Dreamweaver MX inserts the snippet into your document.

Figure 24.3. Use the Code Snippet feature to save frequently used PHP code.

graphics/24fig03.jpg


    Team-Fly    
    Top


    Macromedia Dreamweaver MX Unleashed
    Macromedia Dreamweaver MX 2004 Unleashed
    ISBN: 0672326310
    EAN: 2147483647
    Year: 2002
    Pages: 321

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net