You are previewing HTML, XHTML, and CSS All-In-One Desk Reference For Dummies®.
O'Reilly logo
HTML, XHTML, and CSS All-In-One Desk Reference For Dummies®

Book Description

Want to build a killer Web site? Want to make it easy to keep your site up to date? You'll need to know how CSS, HTML, and XHTML work together. HTML, XHTML, and CSS All-In-One Desk Reference For Dummies makes that easy too! These eight minibooks get you started, explain standards, and help you connect all the dots to create sites with pizzazz.

This handy, one-stop guide catches you up on XHTML basics and CSS fundamentals. You'll learn how to work with Positionable CSS to create floating elements, margins, and multi-column layouts, and you'll get up to speed on client-side programming with JavaScript. You'll also get the low-down on server side programming with PHP, creating a database with MySQL, and using Ajax on both client and server sides. You'll find out how to:

  • Use templates and validators

  • Manage information with lists and tables

  • Turn lists of links into button bars

  • Add style color and borders

  • Create variables for data

  • Add motion with basic DOM animation

  • Work with arrays

  • Add Flash functionality with AFLAX

  • Build and manage a multipage site

  • Choose and run your own server

You don't need expensive or complicated software or a super-powerful computer to build a Web site that does all sorts of amazing things. All you need is a text editor and the clear, step-by-step guidance you'll find in HTML, XHTML, and CSS All-In-One Desk Reference For Dummies.

Table of Contents

  1. Copyright
  2. About the Authors
  3. Authors' Acknowledgments
  4. Publisher's Acknowledgments
  5. Introduction
    1. No Experience Necessary
    2. Great for Advanced Folks, Too!
    3. Use Any Computer
    4. Don't Buy Any Software
    5. How This Book Is Organized
    6. Icons Used in This Book
    7. What's Next?
  6. I. Creating the XHTML Foundation
    1. 1. Sound HTML Foundations
      1. 1.1. Creating a Basic Page
      2. 1.2. Understanding the HTML in the Basic Page
      3. 1.3. Meeting Your New Friends, the Tags
      4. 1.4. Setting Up Your System
        1. 1.4.1. Displaying file extensions
        2. 1.4.2. Setting up your software
    2. 2. It's All about Validation
      1. 2.1. Somebody Stop the HTML Madness!
        1. 2.1.1. XHTML to the rescue
        2. 2.1.2. There's XHTML, and then there's good XHTML
      2. 2.2. Building an XHTML Document
        1. 2.2.1. Don't memorize all this!
        2. 2.2.2. The DOCTYPE tag
        3. 2.2.3. The xmlns attribute
        4. 2.2.4. The meta tag
        5. 2.2.5. You validate me
      3. 2.3. Validating Your Page
        1. 2.3.1. Aesop visits W3C
          1. 2.3.1.1. Examining the overview
          2. 2.3.1.2. Validating the page
          3. 2.3.1.3. Examining the first error
          4. 2.3.1.4. Fixing the title
          5. 2.3.1.5. Solving the next error
          6. 2.3.1.6. Checking the headline repair
        2. 2.3.2. Showing off your mad skillz
        3. 2.3.3. Using Tidy to repair pages
    3. 3. Choosing Your Tools
      1. 3.1. What's Wrong with the Big Boys?
      2. 3.2. Alternative Web Development Tools
        1. 3.2.1. The things you need to have on your computer
        2. 3.2.2. Building a basic toolbox
      3. 3.3. Picking a Text Editor
        1. 3.3.1. Some tools to use when you have nothing else
          1. 3.3.1.1. Windows Notepad
          2. 3.3.1.2. Mac TextEdit
        2. 3.3.2. A noteworthy editor: Notepad++
        3. 3.3.3. The old standards: VI and Emacs
          1. 3.3.3.1. VI and VIM
          2. 3.3.3.2. Emacs
        4. 3.3.4. Other text editors
      4. 3.4. The Web Developer's Browser
        1. 3.4.1. A little ancient history
          1. 3.4.1.1. Mosaic/Netscape — the killer application
          2. 3.4.1.2. Microsoft enters (and wins) the battle
          3. 3.4.1.3. Firefox shakes up the world
        2. 3.4.2. Overview of the prominent browsers
          1. 3.4.2.1. Microsoft Internet Explorer 7
          2. 3.4.2.2. Older versions of Internet Explorer
          3. 3.4.2.3. Mozilla Firefox
        3. 3.4.3. Other notable browsers
          1. 3.4.3.1. Opera
          2. 3.4.3.2. Safari
          3. 3.4.3.3. Mozilla
          4. 3.4.3.4. Portable browsers
          5. 3.4.3.5. Text-only browsers
        4. 3.4.4. The bottom line in browsers
      5. 3.5. Tricking Out Firefox
        1. 3.5.1. Validating your pages with HTML Validator
        2. 3.5.2. Using the Web Developer toolbar
        3. 3.5.3. Using Firebug
      6. 3.6. Using a Full-Blown IDE
        1. 3.6.1. Introducing Nvu
        2. 3.6.2. Introducing Aptana
        3. 3.6.3. Customizing Aptana
          1. 3.6.3.1. Getting to the HTML editor preferences
          2. 3.6.3.2. Changing the extension
          3. 3.6.3.3. Changing the initial contents
          4. 3.6.3.4. Changing the view
    4. 4. Managing Information with Lists and Tables
      1. 4.1. Making a List and Checking It Twice
        1. 4.1.1. Creating an unordered list
          1. 4.1.1.1. Looking at an unordered list
          2. 4.1.1.2. Building an unordered list
        2. 4.1.2. Creating ordered lists
          1. 4.1.2.1. Viewing an ordered list
          2. 4.1.2.2. Building the ordered list
        3. 4.1.3. Making nested lists
          1. 4.1.3.1. Examining the nested list example
          2. 4.1.3.2. Indenting your code
          3. 4.1.3.3. Building a nested list
        4. 4.1.4. Building the definition list
      2. 4.2. Building Tables
        1. 4.2.1. Defining the table
          1. 4.2.1.1. Adding your first row
          2. 4.2.1.2. Making your data rows
          3. 4.2.1.3. Building tables in the text editor
        2. 4.2.2. Spanning rows and columns
          1. 4.2.2.1. Spanning multiple columns
          2. 4.2.2.2. Spanning multiple rows
        3. 4.2.3. Avoiding the table-based layout trap
    5. 5. Making Connections with Links
      1. 5.1. Making Your Text Hyper
        1. 5.1.1. Introducing the anchor tag
        2. 5.1.2. Comparing block-level and inline elements
        3. 5.1.3. Analyzing an anchor
        4. 5.1.4. Introducing URLs
      2. 5.2. Making Lists of Links
      3. 5.3. Working with Absolute and Relative References
        1. 5.3.1. Understanding absolute references
        2. 5.3.2. Introducing relative references
    6. 6. Adding Images
      1. 6.1. Adding Images to Your Pages
        1. 6.1.1. Adding links to images
        2. 6.1.2. Adding inline images using the <img> tag
          1. 6.1.2.1. src (source)
          2. 6.1.2.2. height and width
          3. 6.1.2.3. alt (alternate text)
      2. 6.2. Choosing an Image Manipulation Tool
        1. 6.2.1. An image is worth 3.4 million words!
        2. 6.2.2. Introducing IrfanView
      3. 6.3. Choosing an Image Format
        1. 6.3.1. BMP
        2. 6.3.2. JPG/JPEG
        3. 6.3.3. GIF
        4. 6.3.4. PNG
        5. 6.3.5. Summary of Web image formats
      4. 6.4. Manipulating Your Images
        1. 6.4.1. Changing formats in IrfanView
        2. 6.4.2. Resizing your images
        3. 6.4.3. Enhancing image colors
        4. 6.4.4. Using built-in effects
        5. 6.4.5. Other effects you can use
        6. 6.4.6. Batch processing
      5. 6.5. Using Images as Links
        1. 6.5.1. Creating thumbnail images
        2. 6.5.2. Creating a thumbnail-based image directory
    7. 7. Creating Forms
      1. 7.1. You Have Great Form
        1. 7.1.1. Forms must have some form
        2. 7.1.2. Organizing a form with fieldsets and labels
      2. 7.2. Building Text-Style Inputs
        1. 7.2.1. Making a standard text field
        2. 7.2.2. Building a password field
        3. 7.2.3. Making multi-line text input
      3. 7.3. Creating Multiple Selection Elements
        1. 7.3.1. Making selections
        2. 7.3.2. Building check boxes
        3. 7.3.3. Creating radio buttons
      4. 7.4. Pressing Your Buttons
        1. 7.4.1. Making input-style buttons
        2. 7.4.2. Building a submit button
        3. 7.4.3. It's a do-over: The reset button
        4. 7.4.4. Introducing the button tag
  7. II. Styling with CSS
    1. 1. Coloring Your World
      1. 1.1. Now You Have an Element of Style
        1. 1.1.1. Setting up a style sheet
        2. 1.1.2. Changing the colors
      2. 1.2. Specifying Colors in CSS
        1. 1.2.1. Using color names
        2. 1.2.2. Putting a hex on your colors
        3. 1.2.3. Coloring by number
        4. 1.2.4. Hex education
        5. 1.2.5. Using the Web-safe color palette
      3. 1.3. Choosing Your Colors
        1. 1.3.1. Starting with Web-safe colors
        2. 1.3.2. Modifying your colors
        3. 1.3.3. Doing it on your own pages
        4. 1.3.4. Changing CSS on the fly
      4. 1.4. Creating Your Own Color Scheme
        1. 1.4.1. Understanding hue, saturation, and value
        2. 1.4.2. Using the Color Scheme Generator
        3. 1.4.3. Selecting a base hue
        4. 1.4.4. Picking a color scheme
    2. 2. Styling Text
      1. 2.1. Setting the Font Family
        1. 2.1.1. Applying the font-family style attribute
        2. 2.1.2. Using generic fonts
        3. 2.1.3. Making a list of fonts
      2. 2.2. The Curse of Web-Based Fonts
        1. 2.2.1. Understanding the problem
        2. 2.2.2. Examining possible solutions
        3. 2.2.3. Using images for headlines
      3. 2.3. Specifying the Font Size
        1. 2.3.1. Size is only a suggestion!
        2. 2.3.2. Using the font-size style attribute
        3. 2.3.3. Absolute measurement units
          1. 2.3.3.1. Points (pt)
          2. 2.3.3.2. Pixels (px)
          3. 2.3.3.3. Traditional measurements (in, cm)
        4. 2.3.4. Relative measurement units
          1. 2.3.4.1. Named sizes
          2. 2.3.4.2. Percentage(%)
          3. 2.3.4.3. Em (em)
      4. 2.4. Determining Other Font Characteristics
        1. 2.4.1. Using font-style for italics
        2. 2.4.2. Using font-weight for bold
        3. 2.4.3. Using text-decoration
        4. 2.4.4. Using text-align for basic alignment
        5. 2.4.5. Other text attributes
        6. 2.4.6. Using the font shortcut
        7. 2.4.7. Working with subscripts and superscripts
    3. 3. Selectors, Class, and Style
      1. 3.1. Selecting Particular Segments
        1. 3.1.1. Defining more than one kind of paragraph
        2. 3.1.2. Styling identified paragraphs
      2. 3.2. Using Emphasis and Strong Emphasis
        1. 3.2.1. Adding emphasis to the page
        2. 3.2.2. Modifying the display of em and strong
      3. 3.3. Defining Classes
        1. 3.3.1. Adding classes to the page
        2. 3.3.2. Combining classes
        3. 3.3.3. Combining classes
      4. 3.4. Introducing div and span
        1. 3.4.1. Organizing the page by meaning
        2. 3.4.2. Why not make a table?
      5. 3.5. Using Pseudo-Classes to Style Links
        1. 3.5.1. Styling a standard link
        2. 3.5.2. Styling the link states
        3. 3.5.3. Best link practices
      6. 3.6. Selecting in Context
      7. 3.7. Defining Multiple Styles at Once
    4. 4. Borders and Backgrounds
      1. 4.1. Joining the Border Patrol
        1. 4.1.1. Using the border attributes
        2. 4.1.2. Defining border styles
        3. 4.1.3. Using the border shortcut
        4. 4.1.4. Creating partial borders
      2. 4.2. Introducing the Box Model
        1. 4.2.1. Borders, margin, and padding
        2. 4.2.2. Positioning elements with margins and padding
      3. 4.3. Changing the Background Image
        1. 4.3.1. Getting a background check
        2. 4.3.2. Solutions to the background conundrum
          1. 4.3.2.1. Using a tiled image
          2. 4.3.2.2. Getting a tiled image
          3. 4.3.2.3. Setting background colors
          4. 4.3.2.4. Reducing the contrast
      4. 4.4. Manipulating Background Images
        1. 4.4.1. Turning off the repeat
        2. 4.4.2. Making effective gradients with repeat-xand repeat-y
      5. 4.5. Using Images in Lists
    5. 5. Levels of CSS
      1. 5.1. Managing Levels of Style
        1. 5.1.1. Using local styles
          1. 5.1.1.1. When to use local styles
          2. 5.1.1.2. The drawbacks of local styles
        2. 5.1.2. Using an external style sheet
          1. 5.1.2.1. Defining the external style
          2. 5.1.2.2. Reusing an external CSS style
          3. 5.1.2.3. Understanding the link tag
          4. 5.1.2.4. Specifying an external link
      2. 5.2. Understanding the Cascading Part of Cascading Style Sheets
        1. 5.2.1. Inheriting styles
        2. 5.2.2. Hierarchy of styles
        3. 5.2.3. Overriding styles
        4. 5.2.4. Precedence of style definitions
      3. 5.3. Using Conditional Comments
        1. 5.3.1. Coping with incompatibility
        2. 5.3.2. Making Internet Explorer–specific code
        3. 5.3.3. Using a conditional comment with CSS
        4. 5.3.4. Checking the Internet Explorer version
  8. III. Using Positional CSS for Layout
    1. 1. Fun with the Fabulous Float
      1. 1.1. Avoiding Old-School Layout Pitfalls
        1. 1.1.1. Problems with frames
        2. 1.1.2. Problems with tables
        3. 1.1.3. Problems with huge images
        4. 1.1.4. Problems with Flash
      2. 1.2. Introducing the Floating Layout Mechanism
        1. 1.2.1. Using float with images
        2. 1.2.2. Adding the float property
      3. 1.3. Using Float with Block-Level Elements
        1. 1.3.1. Floating a paragraph
        2. 1.3.2. Adjusting the width
        3. 1.3.3. Setting the next margin
      4. 1.4. Using Float to Style Forms
        1. 1.4.1. Using float to beautify the form
        2. 1.4.2. Adjusting the fieldset width
        3. 1.4.3. Using the clear attribute to control page layout
    2. 2. Building Floating Page Layouts
      1. 2.1. Creating a Basic Two-Column Design
        1. 2.1.1. Designing the page
        2. 2.1.2. Building the XHTML
        3. 2.1.3. Adding preliminary CSS
        4. 2.1.4. Using temporary borders
        5. 2.1.5. Setting up the floating columns
        6. 2.1.6. Tuning up the borders
        7. 2.1.7. Advantages of a fluid layout
      2. 2.2. Building a Three-Column Design
        1. 2.2.1. Styling the three-column page
        2. 2.2.2. Problems with the floating layout
        3. 2.2.3. Specifying a min-height
      3. 2.3. Building a Fixed-Width Layout
        1. 2.3.1. Setting up the XHTML
        2. 2.3.2. Using an image to simulate true columns
      4. 2.4. Building a Centered Fixed-Width Layout
        1. 2.4.1. Making a surrogate body with an all div
        2. 2.4.2. How the jello layout works
        3. 2.4.3. Limitations of the jello layout
    3. 3. Styling Lists and Menus
      1. 3.1. Revisiting List Styles
        1. 3.1.1. Defining navigation as a list of links
        2. 3.1.2. Turning links into buttons
        3. 3.1.3. Building horizontal lists
      2. 3.2. Creating Dynamic Lists
        1. 3.2.1. Building a nested list
        2. 3.2.2. Hiding the inner lists
        3. 3.2.3. Getting the inner lists to appear on cue
      3. 3.3. Building a Basic Menu System
        1. 3.3.1. Building a vertical menu with CSS
        2. 3.3.2. Building a horizontal menu
    4. 4. Using Alternative Positioning
      1. 4.1. Working with Absolute Positioning
        1. 4.1.1. Setting up the HTML
        2. 4.1.2. Adding position guidelines
        3. 4.1.3. Making absolute positioning work
      2. 4.2. Managing z-index
        1. 4.2.1. Handling depth
        2. 4.2.2. Working with z-index
      3. 4.3. Building a Page Layout with Absolute Positioning
        1. 4.3.1. Overview of absolute layout
        2. 4.3.2. Writing the XHTML
        3. 4.3.3. Adding the CSS
      4. 4.4. Creating a More Flexible Layout
        1. 4.4.1. Designing with percentages
        2. 4.4.2. Building the layout
      5. 4.5. Exploring Other Types of Positioning
        1. 4.5.1. Creating a fixed menu system
        2. 4.5.2. Setting up the XHTML
        3. 4.5.3. Setting the CSS values
      6. 4.6. Determining Your Layout Scheme
  9. IV. Client-Side Programming with JavaScript
    1. 1. Getting Started with JavaScript
      1. 1.1. Working in JavaScript
        1. 1.1.1. Choosing a JavaScript editor
        2. 1.1.2. Picking your test browser
      2. 1.2. Writing Your First JavaScript Program
        1. 1.2.1. Embedding your JavaScript code
        2. 1.2.2. Creating comments
        3. 1.2.3. Using the alert() method for output
        4. 1.2.4. Adding the semicolon
      3. 1.3. Introducing Variables
        1. 1.3.1. Creating a variable for data storage
        2. 1.3.2. Asking the user for information
        3. 1.3.3. Responding to the user
      4. 1.4. Using Concatenation to Build Better Greetings
        1. 1.4.1. Comparing literals and variables
        2. 1.4.2. Including spaces in your concatenated phrases
      5. 1.5. Understanding the String Object
        1. 1.5.1. Introducing object-based programming (and cows)
        2. 1.5.2. Investigating the length of a string
        3. 1.5.3. Using string methods to manipulate text
      6. 1.6. Understanding Variable Types
        1. 1.6.1. Adding numbers
        2. 1.6.2. Adding the user's numbers
        3. 1.6.3. The trouble with dynamic data
        4. 1.6.4. The pesky plus sign
      7. 1.7. Changing Variables to the Desired Type
        1. 1.7.1. Using variable conversion tools
        2. 1.7.2. Fixing the addInput code
    2. 2. Making Decisions with Conditions
      1. 2.1. Working with Random Numbers
        1. 2.1.1. Creating an integer within a range
        2. 2.1.2. Building a program that rolls dice
      2. 2.2. Using if to Control Flow
        1. 2.2.1. The basic if statement
        2. 2.2.2. All about conditions
        3. 2.2.3. Comparison operators
      3. 2.3. Using the else Clause
        1. 2.3.1. Using else if for more complex interaction
        2. 2.3.2. Solving the mystery of the unnecessary else
      4. 2.4. Using switch for More Complex Branches
        1. 2.4.1. Creating an expression
        2. 2.4.2. Switching with style
      5. 2.5. Nesting if Statements
        1. 2.5.1. Building the nested conditions
        2. 2.5.2. Making sense of nested ifs
    3. 3. Loops and Debugging
      1. 3.1. Building Counting Loops with for
        1. 3.1.1. Building a standard for loop
        2. 3.1.2. Counting backwards
        3. 3.1.3. Counting by 5
      2. 3.2. Looping for a While
        1. 3.2.1. Creating a basic while loop
        2. 3.2.2. Avoiding loop mistakes
      3. 3.3. Introducing Bad Loops
        1. 3.3.1. Managing the reluctant loop
        2. 3.3.2. Managing the obsessive loop
      4. 3.4. Debugging Your Code
        1. 3.4.1. Letting Aptana help
        2. 3.4.2. Debugging JavaScript on Internet Explorer
        3. 3.4.3. Finding errors in Firefox
        4. 3.4.4. Finding Errors with Firebug
      5. 3.5. Catching Logic Errors
        1. 3.5.1. Logging to the console with Firebug
        2. 3.5.2. Looking at console output
      6. 3.6. Using the Aptana Debug Mode
        1. 3.6.1. Adding a breakpoint
        2. 3.6.2. Running the debugger
        3. 3.6.3. Using the debug perspective
        4. 3.6.4. Examining the debug mode with a paused program
        5. 3.6.5. Walking through your program
        6. 3.6.6. Viewing expression data
    4. 4. Functions and Arrays
      1. 4.1. Breaking Code into Functions
        1. 4.1.1. Thinking about structure
        2. 4.1.2. Building the antsFunction.html program
      2. 4.2. Passing Data into and out of Functions
        1. 4.2.1. Examining the main code
        2. 4.2.2. Looking at the chorus
        3. 4.2.3. Handling the verses
          1. 4.2.3.1. Passing data to the verse() function
          2. 4.2.3.2. Determining the distraction
          3. 4.2.3.3. Creating the text
      3. 4.3. Managing Scope
        1. 4.3.1. Introducing local and global variables
        2. 4.3.2. Examining variable scope
      4. 4.4. Building a Basic Array
        1. 4.4.1. Accessing array data
        2. 4.4.2. Using arrays with for loops
        3. 4.4.3. Revisiting the ants song
      5. 4.5. Working with Two-Dimension Arrays
        1. 4.5.1. Setting up the arrays
        2. 4.5.2. Getting a city
        3. 4.5.3. Creating a main() function
    5. 5. Talking to the Page
      1. 5.1. Understanding the Document Object Model
        1. 5.1.1. Navigating the DOM
        2. 5.1.2. Changing DOM properties with Firebug
        3. 5.1.3. Examining the document object
      2. 5.2. Harnessing the DOM through JavaScript
        1. 5.2.1. Getting the blues, JavaScript-style
        2. 5.2.2. Writing JavaScript code to change colors
      3. 5.3. Managing Button Events
        1. 5.3.1. Embedding quotes within quotes
        2. 5.3.2. Writing the changeColor function
      4. 5.4. Managing Text Input and Output
        1. 5.4.1. Introducing event-driven programming
        2. 5.4.2. Creating the XHTML form
        3. 5.4.3. Using GetElementById to get access to the page
        4. 5.4.4. Manipulating the text fields
      5. 5.5. Writing to the Document
        1. 5.5.1. Preparing the HTML framework
        2. 5.5.2. Writing the JavaScript
        3. 5.5.3. Finding your innerHTML
      6. 5.6. Working with Other Text Elements
        1. 5.6.1. Building the form
        2. 5.6.2. Writing the function
        3. 5.6.3. Understanding generated source
    6. 6. Getting Valid Input
      1. 6.1. Getting Input from a Drop-Down List
        1. 6.1.1. Building the form
        2. 6.1.2. Reading the list box
      2. 6.2. Managing Multiple Selections
        1. 6.2.1. Coding a multiple selection select object
        2. 6.2.2. Writing the JavaScript code
      3. 6.3. Check, Please: Reading Check Boxes
        1. 6.3.1. Building the check box page
        2. 6.3.2. Responding to the check boxes
      4. 6.4. Working with Radio Buttons
        1. 6.4.1. Interpreting radio buttons
      5. 6.5. Working with Regular Expressions
        1. 6.5.1. Introducing regular expressions
        2. 6.5.2. Using characters in regular expressions
        3. 6.5.3. Marking the beginning and end of the line
        4. 6.5.4. Working with special characters
        5. 6.5.5. Conducting repetition operations
        6. 6.5.6. Working with pattern memory
    7. 7. Animating Your Pages
      1. 7.1. Making Things Move
        1. 7.1.1. Looking over the HTML
        2. 7.1.2. Getting an overview of the JavaScript
        3. 7.1.3. Creating global variables
        4. 7.1.4. Initializing
        5. 7.1.5. Moving the sprite
        6. 7.1.6. Checking the boundaries
      2. 7.2. Reading Input from the Keyboard
        1. 7.2.1. Building the keyboard page
        2. 7.2.2. Overwriting the init() function
        3. 7.2.3. Setting up an event handler
        4. 7.2.4. Responding to keystrokes
        5. 7.2.5. Deciphering the mystery of key codes
      3. 7.3. Following the Mouse
        1. 7.3.1. Looking over the HTML
        2. 7.3.2. Initializing the code
        3. 7.3.3. Building the mouse listener
      4. 7.4. Creating Automatic Motion
        1. 7.4.1. Creating a setInterval() call
      5. 7.5. Building Image-Swapping Animation
        1. 7.5.1. Preparing the images
        2. 7.5.2. Building the page
        3. 7.5.3. Building the global variables
        4. 7.5.4. Setting up the interval
        5. 7.5.5. Animating the sprite
      6. 7.6. Movement and Swapping
        1. 7.6.1. Building the code
        2. 7.6.2. Defining global variables
        3. 7.6.3. Initializing your data
        4. 7.6.4. Animating and updating the image
        5. 7.6.5. Moving the sprite
  10. V. Server-Side Programming with PHP
    1. 1. Setting Up Your Server
      1. 1.1. Introducing Server-Side Programming
        1. 1.1.1. Programming on the server
        2. 1.1.2. Serving your programs
        3. 1.1.3. Picking a language
          1. 1.1.3.1. ASP.NET
          2. 1.1.3.2. Java
          3. 1.1.3.3. PHP
      2. 1.2. Installing Your Web Server
        1. 1.2.1. Starting your server
        2. 1.2.2. Testing the installation
      3. 1.3. Inspecting phpinfo()
    2. 2. Generating HTML with PHP
      1. 2.1. Creating Your First PHP Program
      2. 2.2. Coding with Quotation Marks
      3. 2.3. Working with Variables PHP Style
        1. 2.3.1. Concatenation
        2. 2.3.2. Interpolating variables into text
      4. 2.4. Building XHTML Output
        1. 2.4.1. Using double quote interpolation
        2. 2.4.2. Generating output with heredocs
        3. 2.4.3. Switching from PHP to XHTML
    3. 3. PHP and XHTML Forms
      1. 3.1. Exploring the Relationship between PHP and XHTML
        1. 3.1.1. Embedding PHP inside XHTML
        2. 3.1.2. Viewing the results
      2. 3.2. Sending Data to a PHP Program
        1. 3.2.1. Creating a form for PHP processing
        2. 3.2.2. Receiving data in PHP
      3. 3.3. Choosing the Method of Your Madness
        1. 3.3.1. Using get to send data
        2. 3.3.2. Using the post method to transmit form data
        3. 3.3.3. Getting data from the form
      4. 3.4. Retrieving Data from Other Form Elements
        1. 3.4.1. Building a form with complex elements
        2. 3.4.2. Responding to a complex form
    4. 4. Control Structures
      1. 4.1. Introducing if-else Conditionals
        1. 4.1.1. if conditionals
        2. 4.1.2. else conditionals
        3. 4.1.3. Comparison operators
        4. 4.1.4. Logical operators
      2. 4.2. Comparing with switch Structures
      3. 4.3. Looping It Up with Loops
        1. 4.3.1. while loops
        2. 4.3.2. for loops
    5. 5. Working with Arrays
      1. 5.1. Using One-Dimensional Arrays
        1. 5.1.1. Creating an array
        2. 5.1.2. Filling an array after creation
        3. 5.1.3. Filling an array upon creation
        4. 5.1.4. Accessing an array index
        5. 5.1.5. Debugging with print_r
      2. 5.2. Introducing Associative Arrays
      3. 5.3. Expanding to Multidimensional Arrays
        1. 5.3.1. Creating and filling multidimensional arrays
        2. 5.3.2. Accessing a value in a multidimensional array
      4. 5.4. Using foreach Loops to Simplify Array Management
        1. 5.4.1. Using foreach with associative arrays
      5. 5.5. Breaking a String into an Array
        1. 5.5.1. Creating arrays with explode
        2. 5.5.2. Creating arrays with split
    6. 6. Using Functions and Session Variables
      1. 6.1. Creating Your Own Functions
        1. 6.1.1. Rolling dice the old-fashioned way
        2. 6.1.2. Improving code with functions
        3. 6.1.3. Managing variable scope
        4. 6.1.4. Returning data from functions
      2. 6.2. Managing Persistence with Session Variables
        1. 6.2.1. Understanding session variables
        2. 6.2.2. Adding session variables to your code
    7. 7. Working with Files and Directories
      1. 7.1. Text File Manipulation
        1. 7.1.1. Writing text to files
          1. 7.1.1.1. fopen()
          2. 7.1.1.2. fwrite()
          3. 7.1.1.3. fclose()
        2. 7.1.2. Creating a CSV file
          1. 7.1.2.1. str_replace()
          2. 7.1.2.2. The CSV file creation example
        3. 7.1.3. Reading from text files
          1. 7.1.3.1. fgets()
          2. 7.1.3.2. feof()
          3. 7.1.3.3. file()
        4. 7.1.4. Reading from a CSV file
          1. 7.1.4.1. split()
          2. 7.1.4.2. list()
          3. 7.1.4.3. Using split() and list() together
          4. 7.1.4.4. The CSV file read example
      2. 7.2. Working with File and Directory Functions
        1. 7.2.1. opendir()
        2. 7.2.2. readdir()
        3. 7.2.3. chdir()
        4. 7.2.4. Generating the list of file links
    8. 8. Connecting to a MySQL Database
      1. 8.1. Retrieving Data from a Database
        1. 8.1.1. Understanding data connections
        2. 8.1.2. Building a connection
        3. 8.1.3. Passing a query to the database
        4. 8.1.4. Processing the results
        5. 8.1.5. Extracting the rows
        6. 8.1.6. Extracting fields from a row
        7. 8.1.7. Printing the data
      2. 8.2. Improving the Output Format
        1. 8.2.1. Building definition lists
        2. 8.2.2. Using XHTML tables for output
      3. 8.3. Allowing User Interaction
        1. 8.3.1. Building an XHTML search form
        2. 8.3.2. Responding to the search request
        3. 8.3.3. Breaking the code into functions
        4. 8.3.4. Processing the input
        5. 8.3.5. Generating the output
  11. VI. Databases with MySQL
    1. 1. Getting Started with Data
      1. 1.1. Examining the Basic Structure of Data
        1. 1.1.1. Determining the fields in a record
        2. 1.1.2. Introducing SQL data types
        3. 1.1.3. Specifying the length of a record
        4. 1.1.4. Defining a primary key
        5. 1.1.5. Defining the table structure
      2. 1.2. Introducing MySQL
        1. 1.2.1. Why use MySQL?
        2. 1.2.2. Understanding the three-tier architecture
        3. 1.2.3. Practicing with MySQL
      3. 1.3. Setting Up phpMyAdmin
        1. 1.3.1. Changing the root password
        2. 1.3.2. Adding a user
        3. 1.3.3. Using phpMyAdmin on a remote server
      4. 1.4. Making a Database with phpMyAdmin
    2. 2. Managing Data with SQL
      1. 2.1. Writing SQL Code by Hand
        1. 2.1.1. Understanding SQL syntax rules
        2. 2.1.2. Examining the buildContact.sql script
        3. 2.1.3. Dropping a table
        4. 2.1.4. Creating a table
        5. 2.1.5. Adding records to the table
        6. 2.1.6. Viewing the sample data
      2. 2.2. Running a Script with phpMyAdmin
      3. 2.3. Using AUTO_INCREMENT for Primary Keys
      4. 2.4. Selecting Data from Your Tables
        1. 2.4.1. Selecting only a few fields
        2. 2.4.2. Selecting a subset of records
        3. 2.4.3. Searching with partial information
        4. 2.4.4. Searching for the ending value of a field
        5. 2.4.5. Searching for any text in a field
        6. 2.4.6. Searching with regular expressions
        7. 2.4.7. Sorting your responses
      5. 2.5. Editing Records
        1. 2.5.1. Updating a record
        2. 2.5.2. Deleting a record
      6. 2.6. Exporting Your Data and Structure
        1. 2.6.1. Exporting SQL code
        2. 2.6.2. Creating XML data
    3. 3. Normalizing Your Data
      1. 3.1. Recognizing Problems with Single-Table Data
        1. 3.1.1. The identity crisis
        2. 3.1.2. The listed powers
        3. 3.1.3. Repetition and reliability
        4. 3.1.4. Fields that change
        5. 3.1.5. Deletion problems
      2. 3.2. Introducing Entity-Relationship Diagrams
        1. 3.2.1. Using DBDesigner 4 to draw ER diagrams
        2. 3.2.2. Creating a table definition in DBDesigner
        3. 3.2.3. Connecting to a database with DBDesigner
        4. 3.2.4. Manipulating your data from DBDesigner
      3. 3.3. Introducing Normalization
        1. 3.3.1. First normal form
        2. 3.3.2. Second normal form
        3. 3.3.3. Third normal form
      4. 3.4. Identifying Relationships in Your Data
    4. 4. Putting Data Together with Joins
      1. 4.1. Calculating Virtual Fields
        1. 4.1.1. Introducing SQL Functions
        2. 4.1.2. Knowing when to calculate virtual fields
      2. 4.2. Calculating Date Values
        1. 4.2.1. Using DATEDIFF to determine age
        2. 4.2.2. Adding a calculation to get years
        3. 4.2.3. Converting the days integer into a date
        4. 4.2.4. Using YEAR() and MONTH() to get readable values
        5. 4.2.5. Concatenating to make one field
      3. 4.3. Creating a View
      4. 4.4. Using an Inner Join to Combine Tables
        1. 4.4.1. Building a Cartesian join and an inner join
        2. 4.4.2. Enforcing one-to-many relationships
        3. 4.4.3. Counting the advantages of inner joins
        4. 4.4.4. Building a view to encapsulate the join
      5. 4.5. Managing Many-to-Many Joins
        1. 4.5.1. Understanding link tables
        2. 4.5.2. Using link tables to make many-to-many joins
  12. VII. Into the Future with AJAX
    1. 1. AJAX Essentials
      1. 1.1. AJAX Spelled Out
        1. 1.1.1. A is for asynchronous
        2. 1.1.2. J is for JavaScript
        3. 1.1.3. A is for ...and?
        4. 1.1.4. And X is for ...data
      2. 1.2. Making a Basic AJAX Connection
        1. 1.2.1. Building the HTML form
        2. 1.2.2. Creating an XMLHttpRequest object
        3. 1.2.3. Opening a connection to the server
        4. 1.2.4. Sending the request and parameters
        5. 1.2.5. Checking the status
      3. 1.3. All Together Now — Making the Connection Asynchronous
        1. 1.3.1. Setting up the program
        2. 1.3.2. Building the getAJAX() function
        3. 1.3.3. Reading the response
    2. 2. Improving JavaScript with jQuery
      1. 2.1. Introducing jQuery
        1. 2.1.1. Getting acquainted with jQuery
          1. 2.1.1.1. Downloading the jQuery library
          2. 2.1.1.2. Using the documentation
            1. 2.1.1.2.1. The official documentation
            2. 2.1.1.2.2. Tutorials
            3. 2.1.1.2.3. Visual jQuery
        2. 2.1.2. Getting started with jQuery
          1. 2.1.2.1. Including the library
          2. 2.1.2.2. Hello World, jQuery-style
        3. 2.1.3. Coding with jQuery
      2. 2.2. Putting jQuery to Work
        1. 2.2.1. Selecting elements in jQuery
        2. 2.2.2. Selecting all elements of a specific type
        3. 2.2.3. Modifying the list items
        4. 2.2.4. Selecting elements by class name
      3. 2.3. Managing Events through jQuery
        1. 2.3.1. Using bind to bind events to elements
        2. 2.3.2. Unbinding
    3. 3. Animating with jQuery
      1. 3.1. jQuery's Special Effects
        1. 3.1.1. Predefined animations
        2. 3.1.2. Custom animations
      2. 3.2. Interfacing with the Official UI Plugin
        1. 3.2.1. Dragging and dropping
          1. 3.2.1.1. The draggable() function
          2. 3.2.1.2. Dropping with the droppable() function
          3. 3.2.1.3. Playing the Catch the Worms game
        2. 3.2.2. Sorting with the table sorter
          1. 3.2.2.1. Making a basic table
          2. 3.2.2.2. Sorting options
            1. 3.2.2.2.1. sortList
            2. 3.2.2.2.2. sortForce
        3. 3.2.3. Creating dialog boxes
          1. 3.2.3.1. Basic dialog box
            1. 3.2.3.1.1. dialog()
            2. 3.2.3.1.2. dialogClose()
            3. 3.2.3.1.3. dialogOpen()
          2. 3.2.3.2. Dialog box options
            1. 3.2.3.2.1. buttons
            2. 3.2.3.2.2. draggable
            3. 3.2.3.2.3. position
            4. 3.2.3.2.4. Other options
      3. 3.3. Interface Elements for jQuery
        1. 3.3.1. Getting to know the Interface Elements
          1. 3.3.1.1. Super dragging and dropping with the sortables interface
            1. 3.3.1.1.1. Basic sorting
            2. 3.3.1.1.2. Options
            3. 3.3.1.1.3. onchange
        2. 3.3.2. Selectables
          1. 3.3.2.1. Basic selectables
          2. 3.3.2.2. Selectables options
        3. 3.3.3. Making a slider
          1. 3.3.3.1. Basic slider
          2. 3.3.3.2. Slider options
    4. 4. Sending and Receiving Data
      1. 4.1. Working with XML
        1. 4.1.1. Generating XML with PHP
          1. 4.1.1.1. Setting the content type
          2. 4.1.1.2. The XML declaration
          3. 4.1.1.3. Populating the XML document with data
        2. 4.1.2. Handling the XML response with jQuery
          1. 4.1.2.1. Getting the XML from the server
            1. 4.1.2.1.1. Sending the request with jQuery
            2. 4.1.2.1.2. Receiving the response with jQuery
          2. 4.1.2.2. Parsing the XML
      2. 4.2. Introducing JSON
        1. 4.2.1. Overview of JSON
        2. 4.2.2. Using JSON with PHP
          1. 4.2.2.1. json_encode()
          2. 4.2.2.2. json_decode()
        3. 4.2.3. Using JSON with AJAX
          1. 4.2.3.1. Sending the request
          2. 4.2.3.2. Receiving the response
        4. 4.2.4. Generating tables with JSON
  13. VIII. Moving from Web Pages to Web Sites
    1. 1. Managing Your Servers
      1. 1.1. Understanding Clients and Servers
        1. 1.1.1. Parts of a client-side development system
        2. 1.1.2. Parts of a server-side system
      2. 1.2. Creating Your Own Server with XAMPP
        1. 1.2.1. Running XAMPP
        2. 1.2.2. Testing your XAMPP configuration
        3. 1.2.3. Adding your own files
        4. 1.2.4. Setting the security level
        5. 1.2.5. Compromising between functionality and security
      3. 1.3. Choosing a Web Host
        1. 1.3.1. Finding a hosting service
        2. 1.3.2. Connecting to a hosting service
      4. 1.4. Managing a Remote Site
        1. 1.4.1. Using Web-based file tools
        2. 1.4.2. Understanding file permissions
        3. 1.4.3. Using FTP to manage your site
      5. 1.5. Naming Your Site
        1. 1.5.1. Understanding domain names
        2. 1.5.2. Registering a domain name
      6. 1.6. Managing Data Remotely
        1. 1.6.1. Creating your database
        2. 1.6.2. Finding the MySQL server name
    2. 2. Moving from Pages to Sites
      1. 2.1. Creating a Multipage Web Site
      2. 2.2. Planning a Larger Site
      3. 2.3. Understanding the Client
        1. 2.3.1. Ensuring that the client's expectations are clear
        2. 2.3.2. Delineating the tasks
      4. 2.4. Understanding the Audience
        1. 2.4.1. Determining whom you want to reach
        2. 2.4.2. Finding out the user's level of technical expertise
      5. 2.5. Building a Site Plan
        1. 2.5.1. Creating a site overview
        2. 2.5.2. Building the site diagram
      6. 2.6. Creating Page Templates
        1. 2.6.1. Sketching the page design
        2. 2.6.2. Building the XHTML template framework
        3. 2.6.3. Creating page styles
        4. 2.6.4. Building a data framework
      7. 2.7. Fleshing Out the Project
        1. 2.7.1. Making the site live
        2. 2.7.2. Contemplating efficiency
    3. 3. Introducing Content Management Systems
      1. 3.1. Overview of Content Management Systems
      2. 3.2. Previewing Common CMSs
        1. 3.2.1. Moodle
        2. 3.2.2. WordPress
        3. 3.2.3. Drupal
      3. 3.3. Installing a Content Management System
        1. 3.3.1. Adding content
        2. 3.3.2. Building a menu system
        3. 3.3.3. Editing your pages
        4. 3.3.4. Adding a new content block
        5. 3.3.5. Changing the look
    4. 4. Taking Control of Content
      1. 4.1. Getting Started with CMSMS
        1. 4.1.1. Installing CMSMS
        2. 4.1.2. Playing around with the default package
        3. 4.1.3. Adding a new page
      2. 4.2. Customizing CMSMS
        1. 4.2.1. Adding a theme
        2. 4.2.2. Working with templates
        3. 4.2.3. Changing a style
        4. 4.2.4. Adding a custom tag
      3. 4.3. Building a "Poor Man's CMS" with Your Own Code
        1. 4.3.1. Using Server-Side Includes (SSIs)
        2. 4.3.2. Using AJAX/JQuery for client-side
        3. 4.3.3. Building a page with PHP includes
      4. 4.4. Creating Your Own Data-Based CMS
        1. 4.4.1. Using a database to manage content
        2. 4.4.2. Writing a PHP page to read from the table
        3. 4.4.3. Improving the dbCMS design
  14. A. What's on the CD
    1. A.1. System Requirements
    2. A.2. Using the CD
    3. A.3. What You'll Find on the CD
      1. A.3.1. Author-created material
      2. A.3.2. Aptana Studio 1.1, Community Edition
      3. A.3.3. CMS Made Simple 1.2.2
      4. A.3.4. DBDesigner 4.0.5.6
      5. A.3.5. Dia 0.96.1
      6. A.3.6. FireFox 2.0.0.12 and Extensions
      7. A.3.7. GIMP 2.4.4
      8. A.3.8. IrfanView 4.10
      9. A.3.9. jQuery 1.2.1
      10. A.3.10. Nvu 1.0
      11. A.3.11. prototype 1.6
      12. A.3.12. SQLite 303.5.6
      13. A.3.13. WinSCP 4.0.5
      14. A.3.14. Vim 7.1
      15. A.3.15. XAMPP 1.6.4
    4. A.4. Troubleshooting