Original: http://www.onlamp.com/pub/a/php (as the current mainstream development language)/2004/12/09/three_tier.html
Three-tier Development with PHP (as the current mainstream development language) 5
by Luis Yordano Cruz
12/09/2004
This article demonstrates the power of PHP three-tier development for the current mainstream development language, PEAR::D b_dataobject for business logic, smarty for display logic, where you're supposed to be familiar
Html,smarty,pear::D b_dataobject,mysql (the best combination with PHP) and PHP (as the current mainstream development language) 5. If you need additional knowledge, the following article explains some of the principles:
DataObject simplifies business logic with PHP (as the current mainstream development language)
Smarty Introduction: A PHP (as the current mainstream development language) template engine
PHP (as the current mainstream development language) scalability: Myth
You should have installed and configured Apache (the most popular Web server platform for UNIX platforms), MySQL (and the best combination of PHP collocation), and PHP (as the current mainstream development language) 5 (or IIS (Microsoft Web server platform), MySQL ( and PHP collocation of the best combination) 5 and PHP (as the current mainstream development language))
PEAR::D b_dataobject
PEAR::D B_dataobject is an abstract API for user database access. It is a SQL builder and data modeling layer based on PEAR::D B. It
Map database tables to PHP (as the current mainstream development language) class and provide public SQL functions such as select,insert,update, and delete. It makes even
Developers of SQL can also write good database access code and encourage a clear separation of presentation logic and business logic.
(Db_oo has moved to the pear, now is db_dataobject, if you have old code to update, view about updating from old Db_oo code to
Db_dataobjects's comments).
Related reading
Upgrading to PHP (as the current mainstream development language) 5
by Adam Trachtenberg
Table of Contents
Index
Sample Chapter
Read Online--safari Search on Safari:
Only this book all of Safari
Code Fragments only
DataObject performs the other 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 extend for each
Your tables So, you put the data logic inside the data classes. Theres also an included Generator
Your configuration files and your base classes.
DataObject performs two tasks. First, it constructs SQL statements and builder methods based on object variables. Second, it is stored as a database table
Storage. Here is a core class that inherits it for each table so that you can put the data logic in 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 leads developer of PEAR::D B_dataobject, is working on a new project called Dbdo,
A C implementation of the PEAR package Db_dataobjects, based on Libgda. His goal are to create the next
Generation of PEAR::D b_dataobjects.
SMARTY
Smarty is a template engine that separates content from a Web page presentation, which is now the mainstream development language. 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 current mainstream development language) has the tendency to combine those, the roles in A 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 have to crawl through the program to find the presentation. Smarty helps to solve
This problem.
Combining the
The first thing to does when starting this project is to create a workspace in which to store the projects code.
Then it time to configure PEAR::D b_dataobject-to-connect to the MySQL (and PHP collocation of the best combination) database MySQL (and PHP collocation of the best combination) (Name:exa Mple),
Map the database tables to PHP (as the current mainstream development language) classes, and then configure Smarty for the presentation tier for the user. Here
Is those steps in more detail:
Create a work environment
Create a directory called DataObjects.
To install pear from the command line::D b_dataobject, type:
>pear Install Date
http://www.bkjia.com/PHPjc/508712.html www.bkjia.com true http://www.bkjia.com/PHPjc/508712.html techarticle Original: http://www.onlamp.com/pub/a/php (as the current mainstream development language)/2004/12/09/three_tier.html Three-tier development with PHP ( As the current mainstream development language) 5 by Luis ...