Thông tin tài liệu
this print for content only—size & color not accurate spine = 1.1163" 592 page count
Books for professionals By professionals
®
Practical Web 2.0 Applications with PHP
Dear Reader,
Many programming books on the market today focus specifically on a particu-
lar methodology or software package, and although you will gain a solid under-
standing of the subject matter from these books, you won’t always know how
to apply what you’ve learned in a real-world situation. This book is designed
to show you how to bring together many different ideas and features by start-
ing with a clean slate and gradually building the code base so it evolves into a
complete web application.
The premise of the application we build in this book is that it is a “Web 2.0”
application. What this means is that (among other things) our application gen-
erates accessible and standards-compliant code while making heavy of use of
Ajax. We achieve this by using the Smarty
™
Template Engine and Cascading
Style Sheets, as well as the Prototype JavaScript library. Additionally, we create
a fun and intuitive interface by applying simple visual effects on various pages
using the Script.aculo.us JavaScript library.
To help with the development of the extensive PHP code in this book, we
use the Zend Framework. This is an open source PHP 5 library that contains
many different components that you can easily use in any of your day-to-day
development. We use many of the Zend Framework components in this book, such
as database abstraction (with a focus on MySQL
®
and PostgreSQL), logging,
authentication, and search.
The “Web 2.0” application that we build in this book is a collaborative
blogging tool. It will allow users to register and create a personal blog. When
creating blog posts, users will be able upload images, apply tags, and assign
locations (using Google Maps). We will also look at how to use microformats
when displaying user blog posts.
Quentin Zervaas
US $44.99
Shelve in
PHP
User level:
Intermediate–Advanced
Zervaas
Web 2.0
Applications with
PHP
The eXperT’s Voice
®
in WeB DeVelopmenT
Practical
Web 2.0
Applications with PHP
cyan
maGenTa
yelloW
Black
panTone 123 c
Quentin Zervaas
Companion
eBook Available
www.apress.com
SOURCE CODE ONLINE
Companion eBook
See last page for details
on $10 eBook version
ISBN-13: 978-1-59059-906-8
ISBN-10: 1-59059-906-3
9 781590 599068
5 4 4 9 9
Develop a complete PHP web application
from start to finish
RELATED TITLES
Practical
www.it-ebooks.info
www.it-ebooks.info
Quentin Zervaas
Practical Web 2.0
Applications with PHP
9063CH00CMP3 11/19/07 8:39 PM Page i
www.it-ebooks.info
Practical Web 2.0 Applications with PHP
Copyright © 2008 by Quentin Zervaas
All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means,
electronic or mechanical, including photocopying, recording, or by any information storage or retrieval
system, without the prior written permission of the copyright owner and the publisher.
ISBN-13 (pbk): 978-1-59059-906-8
ISBN-10 (pbk): 1-59059-906-3
ISBN-13 (electronic): 978-1-4302-0474-9
ISBN-10 (electronic): 1-4302-0474-5
Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1
Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence
of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark
owner, with no intention of infringement of the trademark.
Lead Editor: Ben Renow-Clarke
Technical Reviewer: Jeff Sambells
Editorial Board: Steve Anglin, Ewan Buckingham, Tony Campbell, Gary Cornell, Jonathan Gennick,
Jason Gilmore, Kevin Goff, Jonathan Hassell, Matthew Moodie, Joseph Ottinger, Jeffrey Pepper,
Ben Renow-Clarke, Dominic Shakeshaft, Matt Wade, Tom Welsh
Project Manager: Richard Dal Porto
Copy Editors: Andy Carroll, Kim Wimpsett
Assistant Production Director: Kari Brooks-Copony
Production Editor: Liz Berry
Compositor: Diana Van Winkle
Proofreader: Lisa Hamilton
Indexer: Broccoli Information Management
Artist: Diana Van Winkle
Cover Designer: Kurt Krames
Manufacturing Director: Tom Debolski
Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor,
New York, NY 10013. Phone 1-800-SPRINGER, fax 201-348-4505, e-mail orders-ny@springer-sbm.com, or
visit http://www.springeronline.com.
For information on translations, please contact Apress directly at 2855 Telegraph Avenue, Suite 600,
Berkeley, CA 94705. Phone 510-549-5930, fax 510-549-5939, e-mail info@apress.com, or visit
http://www.apress.com.
The information in this book is distributed on an “as is” basis, without warranty. Although every precaution
has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any
person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by
the information contained in this work.
The source code for this book is available to readers at http://www.apress.com.
9063CH00CMP3 11/19/07 8:39 PM Page ii
www.it-ebooks.info
Contents at a Glance
About the Author. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv
About the Technical Reviewer
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvi
Introduction
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii
■CHAPTER 1 Application Planning and Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
■CHAPTER 2 Setting Up the Application Framework . . . . . . . . . . . . . . . . . . . . . . . . . . 9
■CHAPTER 3 User Authentication, Authorization, and Management . . . . . . . . . . . . . 45
■CHAPTER 4 User Registration, Login, and Logout . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
■CHAPTER 5 Introduction to Prototype and Scriptaculous . . . . . . . . . . . . . . . . . . 123
■CHAPTER 6 Styling the Web Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
■CHAPTER 7 Building the Blogging System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
■CHAPTER 8 Extending the Blog Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
■CHAPTER 9 Personalized User Areas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
■CHAPTER 10 Implementing Web 2.0 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335
■CHAPTER 11 A Dynamic Image Gallery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371
■CHAPTER 12 Implementing Site Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427
■CHAPTER 13 Integrating Google Maps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 469
■CHAPTER 14 Deployment and Maintenance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 519
■INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 547
iii
9063CH00CMP3 11/19/07 8:39 PM Page iii
www.it-ebooks.info
9063CH00CMP3 11/19/07 8:39 PM Page iv
www.it-ebooks.info
Contents
About the Author. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv
About the Technical Reviewer
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvi
Introduction
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii
■CHAPTER 1
Application Planning and Design
. . . . . . . . . . . . . . . . . . . . . . . . . . 1
What Is Web 2.0? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Database Connectivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Web Site Templates
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Web Site Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Main Home Page and User Home Page . . . . . . . . . . . . . . . . . . . . . . . . 3
User Registration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Account Login and Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
User Blogs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Web Site Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Application Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Other Aspects of Development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Search-Engine Optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
PHPDoc-Style Commenting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Application Logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Maintainability and Extensibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Version Control and Unit Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
■CHAPTER 2 Setting Up the Application Framework . . . . . . . . . . . . . . . . . . . . 9
Web Server Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Operating System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Installing the Apache HTTP Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Installing MySQL 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Installing PHP 5.2.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
v
9063CH00CMP3 11/19/07 8:39 PM Page v
www.it-ebooks.info
■CONTENTSvi
Application Filesystem Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Web Root Directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Data Storage Directory
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
PHP Classes Directory
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Templates Directory
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Full Directory Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Installing the Zend Framework
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Configuring the Web Server
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Creating a Virtual Host in Linux
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Creating a Virtual Host in Windows
. . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Restarting Your Web Server
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Setting Up the Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Using the Model-View-Controller Pattern . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Separating Application Logic from Presentation Logic . . . . . . . . . . . 19
Directing All Requests to index.php . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Introduction to the Zend_Controller Class . . . . . . . . . . . . . . . . . . . . . 22
How Requests Work with Zend_Controller . . . . . . . . . . . . . . . . . . . . . 23
Creating the IndexController . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Defining Application Settings
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Connecting to the Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Testing the Database Connection
. . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
The Smarty Template Engine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Why Not Use a Different Template Engine? . . . . . . . . . . . . . . . . . . . . 33
Downloading and Installing Smarty . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Automatic View Rendering with Zend_Controller . . . . . . . . . . . . . . . 36
Integrating Smarty with the Web Site Controllers . . . . . . . . . . . . . . . 39
Adding Logging Capabilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Writing to the Log File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
■CHAPTER 3
User Authentication, Authorization, and Management
. . . . . . 45
Creating the User Database Table
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Timestamps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
User Profiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Introduction to Zend_Auth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Instantiating Zend_Auth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Authenticating with Zend_Auth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Introduction to Zend_Acl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
A Zend_Acl Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
9063CH00CMP3 11/19/07 8:39 PM Page vi
www.it-ebooks.info
Combining Zend_Auth, Zend_Acl, and Zend_Controller_Front . . . . . . . . 57
Managing User Records with DatabaseObject . . . . . . . . . . . . . . . . . . . . . . 61
The DatabaseObject_User Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Using DatabaseObject_User . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Managing User Profiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Using Profile_User . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Integrating Profile_User with DatabaseObject_User . . . . . . . . . . . . 69
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
■CHAPTER 4 User Registration, Login, and Logout . . . . . . . . . . . . . . . . . . . . . 73
Adding User Registration to the Application . . . . . . . . . . . . . . . . . . . . . . . . 73
Creating the Form Processor for User Registration . . . . . . . . . . . . . 74
Displaying the Registration Form and Processing Registrations . . . 81
Adding CAPTCHA to the User Registration Form . . . . . . . . . . . . . . . . 88
Adding E-mail Functionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Implementing Account Login and Logout . . . . . . . . . . . . . . . . . . . . . . . . . . 100
Creating the Login Template . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
Adding the Account Controller Login Action . . . . . . . . . . . . . . . . . . . 102
Logging Successful and Failed Login Attempts . . . . . . . . . . . . . . . . 105
Logging Users Out of Their Accounts . . . . . . . . . . . . . . . . . . . . . . . . 107
Dealing with Forgotten Passwords
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
Resetting a User’s Password
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
Functions for Resetting Passwords . . . . . . . . . . . . . . . . . . . . . . . . . . 112
Implementing Account Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
Creating the Account Home Page
. . . . . . . . . . . . . . . . . . . . . . . . . . . 116
Updating the Web Site Navigation . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Allowing Users to Update Their Details . . . . . . . . . . . . . . . . . . . . . . . 120
Summary
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
■CHAPTER 5 Introduction to Prototype and Scriptaculous . . . . . . . . . . . . 123
Downloading and Installing Prototype . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Prototype Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
Selecting Objects in the Document Object Model . . . . . . . . . . . . . . . . . . . 124
The $() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
The getElementsByClassName() Function . . . . . . . . . . . . . . . . . . . . 125
The $$() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
The getElementsBySelector() Function . . . . . . . . . . . . . . . . . . . . . . . 129
Prototype’s Hash Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
■CONTENTS vii
vii
9063CH00CMP3 11/19/07 8:39 PM Page vii
www.it-ebooks.info
Other Element Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
Showing and Hiding Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Retrieving Dimensions of Elements . . . . . . . . . . . . . . . . . . . . . . 131
Managing Classes of Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Manipulating Strings with Prototype . . . . . . . . . . . . . . . . . . . . . . . . . 133
Ajax Operations in Prototype . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
Ajax Request Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
Ajax Callback Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
JavaScript Object Notation (JSON) . . . . . . . . . . . . . . . . . . . . . . . . . . 138
An Ajax.Request Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
Event Handling in Prototype . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
Observing an Event . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
Finding Out Which Element an Event Occurred On . . . . . . . . . . . . . 146
Canceling an Event . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
Creating JavaScript Classes in Prototype . . . . . . . . . . . . . . . . . . . . . . . . . 147
Creating a Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
Binding Function Calls to Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
From Prototype to Scriptaculous . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
Prebuilt Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
Drag and Drop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
Visual Effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
DOM Element Builder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
JavaScript Unit Testing
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
Downloading and Installing Scriptaculous
. . . . . . . . . . . . . . . . . . . . . . . . . 154
Combining Prototype, Scriptaculous, Ajax, and PHP
in a Useful Example
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
Creating the Main HTML Page: index.php
. . . . . . . . . . . . . . . . . . . . 156
Styling the Application: styles.css . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Creating and Populating the Database: schema.sql . . . . . . . . . . . . 158
Managing the List Items on the Server Side: items.php . . . . . . . . 159
Processing Ajax Requests on the Server Side: processor.php . . . 161
Creating the Client-Side Application Logic: scripts.js . . . . . . . . . . . 163
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
■CHAPTER 6 Styling the Web Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
Adding Page Titles and Breadcrumbs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
The Breadcrumbs Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
Generating URLs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
Setting the Title and Trail for Each Controller Action . . . . . . . . . . . . 178
Creating a Smarty Plug-In to Output Breadcrumbs . . . . . . . . . . . . 180
Displaying the Page Title . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
■CONTENTSviii
9063CH00CMP3 11/19/07 8:39 PM Page viii
809b8b6f91d5ff50033254241f3132ed
www.it-ebooks.info
[...]... fresh version of PHP Note that these commands only include the minimum options required for compatibility with the code in this book # tar -zxf php- 5.2.3.tar.gz # cd php- 5.2.3 # /configure with- apxs2 \ with- gd with- curl \ with- mysql with- pdo-mysql \ with- jpeg-dir with- png-dir \ with- freetype-dir with- zlib # make # make install Once these commands have successfully executed, PHP should be compiled... command, the Apache httpd.conf file will be modified to load the PHP library; however, you may still need to add the following lines to ensure that Apache recognizes files with the extension php as PHP files: AddType application/x-httpd -php php AddType application/x-httpd -php- source phps This second line is optional, but it is included with the PHP documentation, so I have included it here You should also... We will be using many PHP 5-specific features, so you will not be able to run the code in this book on PHP 4 Strictly speaking, you can use a version of PHP 5 earlier than 5.2.3, but it is best to use the latest available version Note that the Zend Framework requires a minimum PHP version of 5.1.4 Download PHP 5.2.3 (or later) from the PHP web site (http://www .php. net/downloads .php) , and use the following... book, we will develop the entire application within a directory called /var/www/ phpweb20 (with “phpweb20” referring to the title of this book) You can, of course, use whichever directory on your own server that you choose, although we will refer back to this directory name on several occasions Web Root Directory We need to define a root directory for the web server to access This is the directory specified... implementing web applications • Chapter 2, Setting Up the Application Framework In this chapter, we begin to implement the web application This process begins by correctly setting up the environment (that is, installing the correct web server software) and then by creating the initial file structure of the site In addition to connecting to the database with PHP we will handle , user requests with the Zend... implement in place of Zend_Db Web Site Templates One of the reasons PHP has become so popular is that you can easily include PHP code directly within the HTML code you want to output This makes developing simple and small web applications very easy; however, this typically doesn’t scale well When an application grows large, it becomes difficult either to add new functionality within a bunch of HTML markup... (http://www.recite com.au) with two partners Recite Media develops web applications primarily for other development or design companies to resell Its flagship product, Recite CMS, is being used by some of Australia’s largest companies Quentin also runs and writes for his PHP development resource site, PhpRiot (www.phpriot.com), which provides a number of useful articles on a wide variety of PHP- related topics... each user a public home page within our application web site in which all of their blog posts are shown This chapter shows how to implement more advanced URL schemes, as well as shows you how to enable users to customize their own experience by managing their own profiles and settings • Chapter 10, Implementing Web 2.0 Features Although several of the features we define as Web 2.0 (such as standards compliancy... Is Web 2.0? So exactly what defines a web site as being Web 2.0 ? There are many different opinions on this, making it difficult to pinpoint an exact definition; however, some of the features typically associated with Web 2.0 sites are as follows: • Using standards-compliant HTML and CSS This allows sites to work across many platforms and helps with accessibility This includes the use of microformats... Allowing syndication of web site content using RSS • Adding wikis, blogs, or tags Although not everybody is an advocate of the Web 2.0 phrase, the term does signify forward progress in web development And although not everybody has the need to provide a wiki or a blog on their web site, the other characteristics listed (such as correct standards usage) provide a good basis for a web site and should be . $44.99
Shelve in
PHP
User level:
Intermediate–Advanced
Zervaas
Web 2. 0
Applications with
PHP
The eXperT’s Voice
®
in WeB DeVelopmenT
Practical
Web 2. 0
Applications. finish
RELATED TITLES
Practical
www.it-ebooks.info
www.it-ebooks.info
Quentin Zervaas
Practical Web 2. 0
Applications with PHP
906 3CH00CMP3 11/19 /07 8:39 PM Page
Ngày đăng: 19/02/2014, 20:20
Xem thêm: Tài liệu Practical Web 2.0 Applications with PHP pptx, Tài liệu Practical Web 2.0 Applications with PHP pptx