Stylin’ with CSS

The Blog and Books of Charles Wyke-Smith

Codin’ for the Web–Table of Contents

Codin' cover
  1. Introduction •  xiv
  2. Chapter 1 : XHTML: Coding Principles • 2
    1. How PHP Works • 4
    2. Variables • 6
      1. Creating Variables • 7
      2. Naming Variables • 7
      3. Using print and echo • 8
    3. Numeric Variables • 11
    4. Operators • 12
      1. Assignment Operator • 12
      2. Math Operators • 12
      3. Comparison Operators • 13
      4. Increment and Decrement Operators • 13
      5. Concatenating (Joining) Operator • 15
      6. Operator Precedence and Parentheses • 15
    5. Strings • 16
    6. Arrays • 20
      1. Indexed Arrays • 20
      2. Associative Arrays • 22
    7. Functions • 23
      1. Calling a Function • 24
      2. Writing a Function • 24
    8. Code Structures • 26
      1. The If-then-else Structure • 27
      2. PHP’s Simple if-then-else Structure • 29
      3. The else-if Structure • 31
      4. Converting Part of a Script to a Function • 32
    9. Loops • 34
      1. The while Loop • 34
      2. The for Loop: The Iterator • 34
      3. The foreach Loop • 37
    10. Objects • 40
    11. Summary • 42
  3. Chapter 2 : Processing Forms • 44
    1. About User-Supplied Data and the Need for Validation • 46
      1. Is There Any Data at All? • 48
      2. Check for a Specific Character or Word • 48
      3. Check for Patterns in the Data • 48
    2. Creating the Form • 50
      1. Creating the XHTML for a Form • 50
      2. Creating a Self-Requesting Page • 52
      3. Using the $_POST Super-Global Array • 55
      4. Sending E-mail to Yourself with PHP • 57
      5. Creating Sticky Stay-Filled Forms • 59
      6. Combating Magic Quotes • 61
      7. Validating Your Forms • 63
    3. Checking for Empty Fields • 64
      1. Validating Multiple Fields • 65
      2. Building an Error Message Array • 65
      3. Creating an XHTML List of the Error Messages • 66
    4. Checking for Specific Characters • 71
    5. Validating with Regular Expressions • 72
      1. Using Some Simple Regular Expressions • 73
      2. Validating an E-mail Address Pattern • 75
      3. Using an Include to Add the Regular Expressions • 75
    6. Working with Flat Files • 80
      1. Choosing the Read/Write Mode • 81
      2. Storing Flat Files above the Root Folder • 82
    7. Creating a Flat File • 83
      1. Writing to a File • 83
      2. Creating a File: Code Example • 84
    8. Importing a Tab-Delimited File into Excel • 86
    9. Creating a Write-to-File Function • 88
    10. Reading a Flat File with PHP • 90
      1. Reading a Flat File Line by Line • 90
      2. Extracting Each Element of the Record • 91
    11. Displacing the File in a Table • 92
    12. Summary • 93
  4. Chapter 3 : Databases • 94
    1. Data Types and Lengths • 97
    2. Creating the Database and Tables • 98
      1. Creating a Database • 99
      2. Creating a Table • 100
    3. Connecting with Your Database • 103
      1. Opening a connection • 103
      2. Selecting a Database • 105
      3. Using INSERT to Add Data to a Table • 105
      4. Closing the Connection • 106
      5. INSERT: An Example • 106
    4. Using SELECT to Read Data from the Database • 107
    5. Specifying Fields to Retrieve • 111
      1. Matching with WHERE in SELECT Statements • 111
    6. Using UPDATE to Modify Values in a Record • 112
    7. Using DELETE to Remove a Record from a Table • 113
    8. Summary • 114
  5. Chapter 4 : Content Management • 116
    1. Public Pages and Administration Pages: Overview • 118
    2. Creating the Database Tables • 121
      1. Creating the Listings Table • 122
      2. Creating the Categories Table • 123
    3. Creating the Edit Links Form • 124
      1. Setting up the Database Connection • 127
      2. Displaying the Categories in the Topic Category Drop-Down Menu • 128
      3. Adding Content to the Database Using the Edit Links Form • 130
    4. Creating the Links Admin Page • 132
      1. Displaying the Listings Records from the Database • 132
      2. Writing the Listings Records in a Table • 134
    5. Displaying the Links Table Organized by Category • 137
      1. The Plan • 137
      2. Writing a SQL JOIN Query • 137
      3. Adding the Category Headings to the Table • 139
    6. Adding Modify and Delete Links to Each Record • 141
      1. Coding the Modify and Delete Links • 142
      2. Coding the Delete Functionality • 143
    7. Modifying a Record: Going Back to the Edit Links Form Page • 146
      1. Four Possible Edit Links Form Activities • 146
      2. Coding the Edit Links Form to Modify Records • 148
      3. Retrieving One Record Using a SQL JOIN Query • 148
      4. Displaying the Retrieved Data in the Edit Links Form Fields • 150
      5. Making the Menu Sticky • 151
      6. Updating a Record • 153
      7. Sharing Variables between Queries • 154
      8. Writing the UPDATE Query • 155
    8. Adding Finishing Touches to the Edit Links Form Page • 157
      1. Redirecting when a Records Is Successfully Added • 157
      2. Adding a Link to the Links Admin Page • 158
    9. Adding Finishing Touches to the Links Admin Page • 158
      1. Adding CSS Styles to the Links Admin Page • 159
      2. Truncating the Displayed URL Strings • 160
      3. Adding the Success Messages • 163
    10. Creating the Public Listing Page • 165
    11. Summary • 169
  6. Chapter 5 : Cookies and Authentication • 170
    1. Cookies and the Session State • 173
      1. Maintaining the Session State • 174
    2. Using Cookies • 175
      1. Creating a Cookie • 176
      2. Updating and Deleting Cookies • 176
      3. Using Single-Session Cookies • 177
      4. Setting a Cookie • 178
      5. Using the time Function • 179
      6. He’s Baaaack! • 179
    3. Creating Data-Rich Cookies • 180
      1. Using explode and implode to Convert between Arrays and Strings • 180
    4. Authentication Basics • 182
    5. Creating an Authentication System • 185
      1. Sign Up, Sign In: Registration and Credentials • 185
      2. Creating the Authentication System Architecture • 185
    6. Creating the Database Table • 190
      1. Adding Database Functions • 190
    7. Creating the Authentication System Pages • 193
      1. Creating the Sign-Up Page • 193
      2. Creating the Members Only Page • 198
      3. Creating the Not-Signed-In Page • 200
      4. Creating the Lost Password Page • 202
      5. Creating the Sign-In Page • 205
    8. Summary • 208
  7. Chapter 6 : Building a Web Site with PHP • 210
    1. Using include Files to Build Pages • 212
      1. Creating the XHTML include Files • 215
      2. Creating the Navigation include Files • 216
      3. Creating the Reference Links Folder • 218
      4. Creating a Config File • 221
      5. Setting Up the Database include Files • 223
      6. Activating the Navigation Links • 226
    2. Adding the Administration Pages • 227
      1. Transferring the Admin Page Code to the Page Template • 227
      2. Moving the CSS to the Style Sheet • 228
      3. Building the Links Form Page • 231
      4. Beware the Headers Already Sent Error Message • 235
      5. Testing the Form • 236
      6. Adding the Admin Link to the Navigation • 237
    3. Implementing the Authentication System • 238
      1. Setting Up the Admin include Files • 238
      2. Adding the Member’s Page • 243
      3. Adding the Sign-in Page • 245
      4. Securing the Admin Area • 248
      5. Adding the No-Credentials Page • 249
      6. Adding the Lost Password Page • 251
    4. Adding a Downloads Page • 253
    5. Improving the Navigation Bar • 255
      1. Making a Background Image Clickable • 256
    6. Creating Dynamic Navigation • 257
      1. Setting Up the Site Navigation Structure • 258
      2. Displaying the Contents of the Top-Level Folder • 259
      3. Distinguishing between Folders and Files • 261
      4. Creating an Absolute Path to the Top-Level Folder • 262
      5. Filtering Out the Unix Folders • 262
      6. Changing the Folder Names to Display Names • 266
      7. Generating the Links • 269
    7. Making the Page Titles Dynamic • 271
      1. Adding Dynamic Page Title Code to the Page Top include File • 273
    8. Reviewing Our Dynamic Site • 274
    9. Index • 277
  8. TWO ADDITIONAL CHAPTERS AVAILABLE IN THE CODE DOWNLOADS
  9. Chapter A : Unleashing the Geek Within • A-1
    1. Form versus Function • A-3
    2. Use Cases • A-4
    3. Dynamic Web Sites • A-6
    4. Three-Tier Architecture • A-8
      1. Interface • A-8
      2. Middleware • A-9
      3. Database • A-10
    5. Anatomy of the Interface • A-10
      1. Interface Components • A-10
      2. Structure of the Interface: Hierarchical Page Structure • A-12
      3. Interface Summary • A-14
    6. Middleware • A-14
      1. The Concept of Templates • A-16
      2. The Concept of include Files • A-18
      3. Middleware Summary • A-20
    7. Database • A-20
      1. Structure of a Database • A-21
      2. Structured Query Language: SQL • A-24
      3. Database Summary • A-26
    8. Summary • A-26
  10. Chapter B : Coding the Interface • B-1
    1. Writing Code • B-3
    2. Using XHTML and CSS • B-4
    3. Writing Good XHTML • B-5
      1. Writing XHTML Tags • B-6
      2. Specifying Tag Attributes • B-7
      3. Rules for XHTML Markup • B-8
    4. Coding the Interface • B-10
      1. About Block Elements • B-12
      2. About Inline Elements • B-12
      3. Code Element Boxes • B-13
      4. Using div Tags to Give Content Structure • B-15
      5. Creating Navigation Elements • B-19
      6. Creating a Multicolumn Page Layout • B-21
      7. Setting the Width of Elements • B-21
      8. Adding a Header • B-26
      9. Completing the Layout • B-27
    5. Moving the Styles to a Style Sheet • B-32
    6. Summary • B-33
Back to Top