Http://www.onlamp.com/pub/a/php (as the mainstream development language)/2004/12/09/three_tier.html
Three-Tier Development with php (as the mainstream Development language) 5
By Luis Yordano Cruz
12/09/2004
This article demonstrates the powerful functions of layer-3 Development in php (as the mainstream development language). PEAR: DB_DataObject is used for business logic, and Smarty is used for display logic.
I learned HTML, Smarty, PEAR: DB_DataObject, MySQL (the best combination with PHP) and php (as the mainstream development language) 5. if you need additional knowledge, the following articles explain some principles:
Use php (as the mainstream development language) DataObject to simplify business logic
Smarty Introduction: a php (as the mainstream development language) template engine
Php (as the mainstream development language) Scalability: Myth
You should have installed and configured apache (the most popular WEB server platform on the Unix platform), MySQL (the best combination with PHP), and php (as the mainstream development language) 5 (or iis (Microsoft's WEB Server Platform), MySQL (the best combination with PHP) 5 and php (as the mainstream development language ))
PEAR: DB_DataObject
PEAR: DB_DataObject is an abstract API for user database access. It is an SQL builder and Data Modeling Layer Based on PEAR: DB. it
Map database tables to php (as the mainstream development language) classes and provide public SQL functions such as SELECT, INSERT, UPDATE, and DELETE.
The SQL Solution Developer can also write good database access code, and encourage the Demonstration Logic and business logic to have a clear separation.
(The PEAR that DB_OO has been moved to is now DB_DataObject. If you have old code to be updated, view the updates from old db_oo code
DB_DataObjects comments ).
Reading
Upgrading to php (as the mainstream development language) 5
By Adam Trachtenberg
Table of Contents
Index
Sample Chapter
Read Online -- Safari Search this book on Safari:
Only This Book All of Safari
Code Fragments only
DataObject performs two tasks. First, it builds SQL statements based on the objects variables and the builder
Methods. Second, it acts as a datastore for a table row. Theres a core class, which you extend for each
Your tables so that you put the data logic inside the data classes. Theres also an unsupported ded Generator to make
Your configuration files and your base classes.
DataObject executes two tasks. First, it constructs SQL statements and builder methods based on object variables. Second, it is used as the data storage of database tables.
Store. Here there is a core class that inherits from each table so that you can put the data logic into the data class. This also includes a generator,
DataObject greatly simplifies database access code, making it easier to develop large, data-driven sites.
At present, Alan Knowles, the lead developer of PEAR: DB_DataObject, is working on a new project called DBDO,
A C implementation of the PEAR package DB_DataObjects, based on libgda. His goal is to create the next
Generation of PEAR: DB_DataObjects.
SMARTY
Smarty is a php (as the mainstream development language) template engine that separates content from the web page demonstration. It uses the GPL license.
Large projects commonly separate the role of the graphic designer from that of the programmer. However,
Programming in php (as the mainstream development language) has the tendency to combine those two roles in a person and inside the code. This can bring
Difficulties when it comes time to change some part of the pages design. If the page mixes content and
Presentation, the developer has to crawl through the program to find the presentation. Smarty helps to solve
This problem.
Combining the Two
The first thing to do when starting this project is to create a workspace in which to store the projects code.
Then its time to configure PEAR: DB_DataObject to connect to the MySQL (the best combination with PHP) database MySQL (the best combination with PHP) (name: example ),
Map the database tables to php (as the mainstream development language) classes, and then configure Smarty for the presentation tier for the user. Here
Are those steps in more detail:
Create a work environment
Create a directory named dataobjects.
Install PEAR: DB_DataObject from the command line, and type:
> Pear install Date