You are previewing The Essential Guide to Dreamweaver CS3 with CSS, Ajax, and PHP.
O'Reilly logo
The Essential Guide to Dreamweaver CS3 with CSS, Ajax, and PHP

Book Description

With over 3 million users worldwide, Adobe's Dreamweaver is the most popular web development software in the world, and it just took another step forward with CS3, the new version released in 2007. Having come a long way from its humble beginnings as a simple web design tool, CS3 allows you to rapidly put together standards compliant web sites and dynamic web sites with server-side languages and Ajax, and much more.

To complement this great new application, David Powers has written the ultimate guide to it-The Essential Guide to Dreamweaver CS3 teaches you everything you need to know about the application, from setting up your development environment environment to publishing your sites and applications on the web, and everything in between.

  • Takes you through your development environment set up

  • Covers everything you need to create both standards compliant web sutes, and dynamic web applications

  • Teaches several real world techniques using a series of step by step tutorials

Table of Contents

  1. Copyright
  2. FOREWORD
  3. ABOUT THE AUTHOR
  4. ABOUT THE TECHNICAL REVIEWER
  5. ACKNOWLEDGMENTS
  6. INTRODUCTION
    1. Who this book is for
    2. Do I need Dreamweaver CS3?
    3. How does this book differ from my previous ones?
    4. How this book is organized
    5. What this book isn't
    6. Windows- and Mac-friendly
    7. A note about versions used
    8. Using the download files
    9. Support for this book
    10. Layout conventions
  7. 1. DREAMWEAVER CS3—YOUR CREATIVE PARTNER
    1. Getting your bearings in Dreamweaver
      1. Starting up
        1. Creating a new document
        2. Setting new document preferences
      2. Exploring the workspace
        1. Insert bar
        2. Document window
      3. Organizing your workspace
        1. Rearranging panels
        2. Saving and sharing customized workspace layouts
        3. Accessing hidden files and folders in Windows
        4. Displaying optional toolbars
        5. Temporarily hiding all panels
    2. Organizing visual assets with Bridge
      1. Controlling thumbnails
      2. Adding metadata
      3. Renaming files
      4. Dragging and dropping files
    3. Creating standards-compliant web pages
      1. Enhanced CSS support
        1. Layers are dead . . . Welcome, AP elements
        2. Seeing the impact of CSS changes in real time
        3. Improved style sheet management
        4. Using visual aids to understand your CSS structure
        5. Checking for browser bugs
        6. Checking what your page will look like on other media
      2. Understanding Dreamweaver's approach to layout
        1. Drawing absolutely positioned elements
        2. Layout Mode goes into exile
      3. Getting the best out of Code view
        1. Using the Coding toolbar
        2. Setting Code view options
        3. Using code hints and auto completion
    4. Dynamic too . . .
  8. 2. BUILDING DYNAMIC SITES WITH AJAX AND PHP
    1. Understanding how dynamic pages work
      1. Making pages dynamic with client-side technology
      2. Increasing user interactivity with server-side technology
        1. Why choose PHP?
      3. Taking dynamic functionality a stage further with Ajax
        1. Understanding the limitations of Ajax
      4. Dynamic terminology 101
    2. Using Dreamweaver behaviors and Spry effects
      1. Accessing the Behaviors panel
      2. Giving elements a unique identity
        1. Removing an id attribute
      3. Editing behavior and effect settings
        1. Removing behaviors and effects cleanly
        2. Restoring a deleted behavior or effect
      4. Exploring Spry effects
        1. Appear/Fade
        2. Blind
        3. Grow/Shrink
        4. Highlight
        5. Shake
        6. Slide
        7. Squish
      5. Creating a wrapper <div> for the Slide effect
      6. Applying multiple events to a trigger element
    3. Handling dynamic data with Spry and PHP
      1. Comparing how Spry and PHP handle data sets
      2. Building PHP sites with Dreamweaver
      3. Comparing different versions of files
        1. Setting up the File Compare feature
        2. Using File Compare
        3. Comparing two local files in the same site
        4. Comparing two local files in different sites
        5. Comparing local and remote files
      4. Meet Mark of the Web
    4. The next step
  9. 3. GETTING THE WORK ENVIRONMENT READY
    1. Deciding where to test your pages
      1. Checking that your remote server supports PHP
    2. Creating a local testing server
      1. Choosing which versions to install
      2. Choosing individual installation or an all-in-one package
      3. Setting up on Windows
        1. Getting Windows to display file name extensions
        2. Choosing the right web server
        3. Downloading the software
        4. Preparing for installation on Windows Vista
        5. Turning off User Account Control temporarily on Vista
        6. Before you begin . . .
        7. Checking that port 80 is free
        8. Installing Apache on Windows
        9. Running the Apache Monitor on Vista
        10. Starting and stopping Apache on Windows
        11. Changing startup preferences or disabling Apache
        12. Installing PHP on Windows
        13. Testing your PHP installation (Windows XP and Vista)
        14. Changing the default Apache port
        15. Changing the default IIS port
      4. Setting up on Mac OS X
        1. Starting and stopping Apache on Mac OS X
        2. Upgrading PHP on Mac OS X
    3. Checking your PHP configuration
      1. Understanding the output of phpinfo()
        1. Checking the location of php.ini
        2. Checking PHP Core settings
        3. Checking installed extensions
        4. Checking supported $_SERVER variables
      2. Editing php.ini
        1. Accessing php.ini on Mac OS X
        2. Configuring PHP to display errors
        3. Enabling PHP extensions on Windows
        4. Enabling file uploads and sessions (Windows installer)
      3. Overriding settings on your remote server
        1. Suppressing error messages
        2. Overriding default settings with ini_set()
        3. Using .htaccess to change default settings
    4. Summary
  10. 4. SETTING UP A PHP SITE
    1. Deciding where to locate your sites
      1. Understanding document- and root-relative links
        1. Document-relative links
        2. Root-relative links
      2. Keeping everything together in the server root
      3. Working with virtual hosts
      4. Finding the server root
      5. Moving the Apache server root on Windows
      6. Setting a default file for Apache on Windows
      7. Adding a default PHP file to IIS
    2. Creating virtual hosts on Apache
      1. Registering virtual hosts on Windows
      2. Registering virtual hosts on Mac OS X
    3. Registering virtual directories on IIS
    4. Defining a PHP site in Dreamweaver
      1. Opening the Site Definition dialog box
      2. Telling Dreamweaver where to find local files
      3. Telling Dreamweaver how to access your remote server
      4. Defining the testing server
        1. Selecting options for local testing
        2. Selecting options for remote testing
      5. Setting up other site options
        1. Setting up for Spry
      6. Saving the site definition
      7. Testing your PHP site
        1. Troubleshooting
      8. Setting options for Preview in Browser
    5. Managing Dreamweaver sites
    6. Now let's get on with it . . .
  11. 5. ADDING A TOUCH OF STYLE
    1. Avoiding bad habits
      1. Stay away from the Property inspector for fonts
      2. Creating simple CSS for beginners
    2. Introducing the CSS Styles panel
      1. Opening the CSS Styles panel
      2. Viewing All and Current modes
      3. Exploring the Properties pane of the CSS Styles panel
        1. Displaying CSS properties by category
        2. Displaying CSS properties alphabetically
        3. Displaying only CSS properties that have been set
        4. Attaching a new style sheet
        5. Adding, editing, and deleting style rules
    3. Creating new style rules
      1. Defining a selector
      2. Defining the rule's properties
    4. Moving style rules
      1. Exporting rules to a new style sheet
      2. Moving rules within a style sheet
      3. Moving rules between external style sheets
    5. Setting your CSS preferences
      1. Creating and editing style rules
      2. Setting the default format of style rules
    6. Let's get creative . . .
  12. 6. CREATING A CSS SITE STRAIGHT OUT OF THE BOX
    1. Using a built-in CSS layout
      1. Choosing a layout
      2. Deciding where to locate your style rules
        1. Linking to existing style sheets
        2. Making sure conditional comments are applied
      3. Styling a page
      4. Inspecting the cascade in Current mode
      5. Finishing the layout
      6. Removing the CSS comments
    2. How was it for you?
  13. 7. BUILDING SITE NAVIGATION WITH THE SPRY MENU BAR
    1. Examining the structure of a Spry menu bar
      1. Looking at the XHTML structure
      2. Removing a menu bar
      3. Editing a menu bar
      4. Maintaining accessibility with the Spry menu bar
      5. Customizing the styles
        1. Changing the menu width
        2. Changing colors
        3. Adding borders
        4. Changing the font
    2. Styling a Spry menu bar
      1. To wrap or not to wrap, that is the question . . .
      2. Building the navigation structure
      3. Customizing the design
    3. A mixed blessing
  14. 8. SPRUCING UP CONTENT WITH SPRY WIDGETS
    1. Features common to all Spry widgets
    2. Building a tabbed interface
      1. Examining the structure of the tabbed panels widget
      2. Editing a tabbed panels widget
      3. Selecting harmonious colors
      4. Converting to vertical tabs
      5. Avoiding design problems with tabbed panels
    3. Understanding Spry objects
    4. Using the accordion widget
      1. Examining the structure of an accordion
      2. Editing and styling a Spry Accordion
      3. Using the object initialization to change accordion defaults
      4. Opening an accordion panel from a link
    5. Using collapsible panels
      1. Examining the structure of a collapsible panel
      2. Editing and styling collapsible panels
      3. Opening a collapsible panel from a link
    6. Removing a Spry widget
    7. Yet more widgets . . .
  15. 9. BUILDING ONLINE FORMS AND VALIDATING INPUT
    1. Building a simple feedback form
      1. Choosing the right page type
        1. Creating a PHP page
        2. Mixing .php and .html pages in a site
      2. Inserting a form in a page
        1. Inserting a form in Code view
      3. Adding text input elements
        1. Setting properties for text input elements
        2. Converting a text field to a text area and vice versa
      4. Styling the basic feedback form
      5. Understanding the difference between GET and POST
      6. Passing information through a hidden field
    2. Using multiple-choice form elements
      1. Offering a range of choices with checkboxes
      2. Offering a single choice from a drop-down menu
      3. Creating a multiple-choice scrollable list
      4. Using radio buttons to offer a single choice
    3. Organizing form elements in logical groups
      1. Inserting a fieldset
    4. Validating user input before submission
      1. Doing minimal checks with the Validate Form behavior
      2. Using Spry validation widgets for sophisticated checks
        1. Understanding the limitations of Spry validation widgets
        2. Inserting a Spry validation widget
        3. Removing a validation widget
        4. Validating a text field with Spry
        5. Building your own custom pattern
        6. Validating a text area with Spry
        7. Validating a single checkbox with Spry
        8. Validating a checkbox group with Spry
        9. Validating a drop-down menu with Spry
    5. Next, let's move to the server side . . .
  16. 10. INTRODUCING THE BASICS OF PHP
    1. Introducing the basics of PHP
      1. Embedding PHP in a web page
      2. Ending commands with a semicolon
      3. Using variables to represent changing values
        1. Naming variables
        2. Assigning values to variables
      4. Displaying PHP output
      5. Commenting scripts for clarity and debugging
      6. Choosing single or double quotation marks
        1. Using escape sequences in strings
        2. Joining strings together
        3. Adding to an existing string
        4. Using quotes efficiently
        5. Special cases: true, false and null
      7. Working with numbers
        1. Performing calculations
        2. Combining calculations and assignment
      8. Using arrays to store multiple values
        1. Using names to identify array elements
        2. Inspecting the contents of an array with print_r()
      9. Making decisions
        1. The truth according to PHP
        2. Using comparisons to make decisions
        3. Testing more than one condition
        4. Using the switch statement for decision chains
        5. Using the conditional operator
      10. Using loops for repetitive tasks
        1. Loops using while and do . . . while
        2. The versatile for loop
        3. Looping through arrays with foreach
        4. Breaking out of a loop
      11. Using functions for preset tasks
      12. Understanding PHP error messages
    2. Now put it to work . . .
  17. 11. USING PHP TO PROCESS A FORM
    1. Activating the form
      1. Getting information from the server with PHP superglobals
      2. Sending email
        1. Scripting the feedback form
        2. Using Balance Braces
        3. Testing the feedback form
        4. Troubleshooting mail()
        5. Getting rid of unwanted backslashes
        6. Making sure required fields aren't blank
        7. Preserving user input when a form is incomplete
        8. Filtering out potential attacks
        9. Safely including the user's address in email headers
        10. Handling multiple-choice form elements
      3. Redirecting to another page
    2. Time for a breather . . .
  18. 12. WORKING WITH PHP INCLUDES AND TEMPLATES
    1. Including text and code from other files
      1. Introducing the PHP include commands
      2. Telling PHP where to find the external file
      3. Using site-root-relative links with includes
      4. Lightening your workload with includes
        1. Choosing the right file name extension for include files
        2. Displaying XHTML output
        3. Avoiding problems with include files
        4. Applying styles with Design Time Style Sheets
        5. Adding dynamic code to an include
        6. Using includes to recycle frequently used PHP code
      5. Adapting the mail processing script as an include
        1. Analyzing the script
        2. Building the message body with a generic script
      6. Avoiding the "headers already sent" error
    2. Using Dreamweaver templates in a PHP site
      1. Creating a template
      2. Adding editable regions to the master template
      3. Creating child pages from a template
      4. Locking code outside the <html> tags
    3. Choosing the right tool
  19. 13. SETTING UP MYSQL AND PHPMYADMIN
    1. Introducing MySQL
      1. Understanding basic MySQL terminology
    2. Installing MySQL
      1. Installing MySQL on Windows
        1. Deciding whether to enable InnoDB support
      2. Changing the default table type on Windows Essentials
      3. Starting and stopping MySQL manually on Windows
      4. Using the MySQL monitor on Windows
    3. Setting up MySQL on Mac OS X
      1. Adding MySQL to your PATH
      2. Securing MySQL on Mac OS X
    4. Using the MySQL monitor on Windows and Mac
    5. Using MySQL with phpMyAdmin
      1. Setting up phpMyAdmin on Windows and Mac
      2. Launching phpMyAdmin
        1. Logging out of phpMyAdmin
    6. Backup and data transfer
    7. Looking ahead . . .
  20. 14. STORING RECORDS IN A DATABASE
    1. Setting up a database in MySQL
      1. Creating a local database for testing
      2. Creating user accounts for MySQL
        1. Granting the necessary user privileges
    2. How a database stores information
      1. How primary keys work
      2. Designing a database table
        1. Choosing the table name
        2. Deciding how many columns to create
        3. Choosing the right column type in MySQL
        4. Deciding whether a field can be empty
    3. Storing input from the feedback form
      1. Analyzing the form
      2. Defining a table in phpMyAdmin
        1. Understanding collation
      3. Inserting data from the feedback form
        1. Troubleshooting the connection
        2. Troubleshooting
      4. Using server behaviors with site-root-relative links
      5. Inspecting the server behavior code
      6. Inserting data into SET columns
    4. Displaying database content
      1. Creating a recordset
      2. Displaying individual records
        1. Displaying line breaks in text
    5. Merging form input with mail processing
    6. A great deal achieved
  21. 15. CONTROLLING ACCESS TO YOUR SITE
    1. Creating a user registration system
      1. Defining the database table
      2. Building the registration form
      3. Preserving the integrity of your records
        1. Building custom server behaviors
        2. Completing the user registration form
      4. Updating and deleting user records
        1. Adapting the Sticky Text Field server behavior
        2. Building the update and delete pages
    2. What sessions are and how they work
      1. Creating PHP sessions
      2. Creating and destroying session variables
      3. Destroying a session
      4. Checking that sessions are enabled
    3. Registering and authenticating users
      1. Creating a login system
      2. Restricting access to individual pages
      3. Logging out users
      4. Understanding how Dreamweaver tracks users
        1. Creating your own $_SESSION variables from user details
        2. Redirecting to a personal page after login
      5. Encrypting and decrypting passwords
    4. Feeling more secure?
  22. 16. WORKING WITH MULTIPLE TABLES
    1. Storing related information in separate tables
      1. Deciding on the best structure
      2. Using foreign keys to link records
      3. Avoiding orphaned records
      4. Defining the database tables
        1. Adding an index to a column
        2. Defining the foreign key relationship in InnoDB
      5. Populating the tables
        1. Restoring the content of the tables
    2. Selecting records from more than one table
    3. The four essential SQL commands
      1. SELECT
      2. INSERT
      3. UPDATE
      4. DELETE
    4. Managing content with multiple tables
      1. Inserting new quotations
        1. Using a MySQL function and alias to manipulate data
      2. Inserting new authors
        1. Using variables in a SQL query
      3. Updating authors
      4. Deleting authors
        1. Improving the delete form
        2. Performing a cascading delete with InnoDB tables
      5. Updating quotations
        1. Solving the mystery of missing records
      6. Deleting quotations
    5. What you have achieved
  23. 17. SEARCHING RECORDS AND HANDLING DATES
    1. Querying a database and displaying the results
      1. Enhancing the look of search results
        1. Displaying the number of search results
        2. Creating striped table rows
      2. Understanding how Dreamweaver builds a SQL query
        1. Troubleshooting SQL queries
    2. Setting search criteria
      1. Using numerical comparisons
      2. Searching within a numerical range
      3. Searching for text
        1. Making a search case sensitive
        2. Displaying a message when no results are found
        3. Searching multiple columns
      4. Searching with a partial match
        1. Using wildcard characters in a search
        2. Using wildcard characters with numbers
        3. Using a FULLTEXT index
    3. Solving common problems
      1. Counting records
      2. Eliminating duplicates from a recordset
      3. Reusing a recordset
        1. Understanding how a repeat region works
    4. Formatting dates and time in MySQL
      1. Using DATE_FORMAT() to output user-friendly dates
    5. Working with dates in PHP
      1. Setting the correct time zone
      2. Creating a Unix timestamp
      3. Formatting dates in PHP
    6. Storing dates in MySQL
      1. Validating and formatting dates for database input
    7. Continuing the search for perfection
  24. 18. USING XSLT TO DISPLAY LIVE NEWS FEEDS AND XML
    1. A quick guide to XML and XSLT
      1. What an XML document looks like
        1. Using HTML entities in XML
      2. Using XSLT to display XML
        1. Checking your server's support for XSLT
    2. Pulling in an RSS news feed
      1. How Dreamweaver handles server-side XSLT
      2. Using XSLT to access the XML source data
      3. Displaying the news feed in a web page
    3. Being a bit more adventurous with XSLT
      1. Setting up a local XML source
      2. Understanding how XSLT is structured
      3. Accessing nested repeating elements
      4. Creating conditional regions
        1. Testing a single condition
        2. Testing alternative conditions
      5. Sorting elements
      6. Formatting elements
      7. Displaying output selectively
        1. Filtering nodes with XPath
        2. Using XSLT parameters to filter data
    4. More XML to come . . .
  25. 19. USING SPRY TO DISPLAY XML
    1. How Spry handles XML data
      1. Making sure Spry can find data
      2. Creating a Spry data set
      3. Displaying a data set in a Spry table
      4. Understanding the Spry data code
        1. Validating pages that use Spry
      5. The fly in Spry's ointment
      6. Displaying a data set as a list
        1. What's the difference between repeat and repeatchildren?
    2. Case study: Building a Spry image gallery
      1. Planning the gallery
        1. Dynamically selecting the gallery data set
        2. Controlling the structure with CSS
      2. Putting everything together
      3. Activating the event handling
        1. Distinguishing between data sets
        2. Creating a data set dynamically
    3. Nearly there . . .
  26. 20. GETTING THE BEST OF BOTH WORLDS WITH PHP AND SPRY
    1. Generating XML dynamically
      1. Preparing the database table
      2. Using phpMyAdmin to generate XML
      3. Using the XML Export extension
        1. Updating the includes folder
      4. Building XML manually from a recordset
      5. Using a proxy script to fetch a remote feed
      6. Creating an XML document from a dynamic source
        1. Setting permission for PHP to write files
        2. Using PHP to write to a file
    2. Using Spry in pages that work without JavaScript
      1. How to incorporate a Spry data set in an ordinary web page
      2. Using XHTML with Spry
    3. Case study: Making the Spry gallery accessible
      1. Creating the gallery with PHP
      2. Generating the XML sources with PHP
      3. Enhancing the accessible gallery with Spry
    4. The end of a long journey . . .