Contents
Chapter 1: Setting Up a PHP Development Environment
Why You Need Apache, MySQL, and PHP
Installing PHP, Apache, and MySQL
Verify That Apache and PHP Are Running
Chapter 2: Understanding PHP: Language Basics
Creating an HTML5 Page with PHP
Including a Simple Page Template
Making a Dynamic Site Navigation
Using isset( ) to Test If a Variable Is Set
Including Page Views Dynamically
Highlighting Current Navigation Item with a Dynamic Style Rule
Creating Page Views for the Form
Spending Your Time Wisely: Conventions and Reuse
The Basic Syntax for Functions
Using Function Arguments for Increased Flexibility
Chapter 4: Building a Dynamic Image Gallery with Image Upload
Prerequisites: A Folder with Some Images
Creating Two Dummy Page View Files
Adding Two Style Sheets to One Page
Improving the Page_Data Class with a Method
You Can Only Use Methods That Are Declared
Preparing a Function for Displaying Images
Using a DirectoryIterator to Find Files in a Folder
Showing a Form for Uploading Images
The Single Responsibility Principle
Chapter 5: Spicing Up Your Image Gallery with JavaScript and CSS
Client-Side vs. Server-Side Programming
Embedding an External JavaScript File
Preparing the Page_Data Class for JavaScript Files
Preparing the Page Template for JavaScript Files
Writing and Running an External JavaScript File
Simple Progressive Enhancement
Creating Markup for the Overlay and Big Image
Hiding the Overlay and Resize Thumbnails
Chapter 6: Working with Databases
The Basics of MySQL Data Storage
Developing a Database for the Poll
Creating a Database Using CREATE
Coding a Database-Driven Site Poll
Hooking Up Poll View with Poll Model
Coding Is Like Playing the Blues
Sharing the Database Connection with the Poll Model
Retrieving Data with a PDOStatement
Updating a Database Table According to Form Input
Chapter 7: Building the Entry Manager
Creating the blog_entry Database Table
Creating the Entry Manager Navigation
Loading Admin Module Controllers
Processing Form Input and Saving the Entry
Chapter 8: Showing Blog Entries
Creating a Public Blog Front Page
Getting Data for All Blog Entries
Preparing a View for All Blog Entries
Using the Private Access Modifier
Chapter 9: Deleting and Updating Entries
Creating a Model for Administrative Links
Displaying Administrative Links
Populating Your Form with the Entry to Be Edited
Deleting Entries from the Database
Preparing a Model to Update Entries in the Database
Controller: Should I Insert or Update?
Improving Editor Usability with Progressive Enhancement
Embedding Your External JavaScript
Showing a Warning If Title Is Empty
A Coding Challenge: Fix a Usability Flaw
Chapter 10: Improving Your Blog with User Comments and Search
Building and Displaying the Comment Entry Form
Creating a Comment Table in the Database
Building a Comment_Table Class
Using Inheritance in Your Code
Inserting New Comments into the Database
Retrieving All Comments for a Given Entry
Inserting a Comment Through the Comment Form
Loading a Search Result View from the Controller
Chapter 11: Adding Images to Blog Entries
Problem: Cannot Delete an Entry with Comments
Understanding Foreign Key Constraints
Deleting Comments Before Blog Entry
Improving Usability with WYSIWYG
Showing a Form for Uploading Images
A Quick Refresher on the $_FILES Superglobal Array
Using an Image in a Blog Entry
Chapter 12: Password Protection
Creating an admin_table in the Database
Adding Administrators in the Database
Saving New Administrators in the Database
Hiding Controls from Unauthorized Users
Allowing Authorized Users Only
Chapter 13: Going Public with Your Blog
Exporting and Importing Your Database
Preparing Your PHP Files for Upload
18.117.187.113