选择显示字体大小

用php5进行三层开发

原文:http://www.onlamp.com/pub/a/php/2004/12/09/three_tier.html
three-tier development with php 5
by luis yordano cruz
12/09/2004

此文演示了php三层开发的强大功能,pear::db_dataobject用于业务逻辑,smarty用于显示逻辑,这里假设你熟

悉了html,smarty,pear::db_dataobject,mysqlphp5.如果你需要补充知识,下面的文章解释了一些原理:

php dataobject简化业务逻辑
smarty简介:一个php模板引擎
php可伸缩性:myth

你应该已安装和配置好了apache,mysql,和php5(或者iis,mysql5和php)

pear::db_dataobject
pear::db_dataobject 是一个用户数据库访问的抽象api.它是一个基于pear::db的sql构建器和数据建模层.它

数据库表映射到php类并且提供像select,insert,update,和delete这样的公共sql函数.这使即使不了

解sql的开发者也可以写出好的数据库访问代码,并且鼓励演示逻辑和业务逻辑有一个清晰的分离.

(db_oo已经移动到的pear,现在是db_dataobject,如果你有老的代码要更新,查看关于从老的db_oo代码更新到

db_dataobjects的注释).

相关阅读
 
upgrading to php 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 object's variables and the builder

methods. second, it acts as a datastore for a table row. there's a core class, which you extend for each of

your tables so that you put the data logic inside the data classes. there's also an included generator to make

your configuration files and your base classes.

dataobject 执行两个任务.第一,它构建基于对象变量的sql语句和构建器方法.第二,它作为数据库表的数据存

储.这里有个核心类,对于每个表继承它,以使你把数据逻辑放入数据类中.这里还包括一个生成器,


dataobject 极大的简化了数据库访问代码,它使开发大型的,数据驱动的站点更加容易.

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是一个从web页演示中分离内容的php模板引擎.它使用gpl许可.

large projects commonly separate the role of the graphic designer from that of the programmer. however,

programming in php 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 page's 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 project's code.

then it's time to configure pear::db_dataobject to connect to the mysql database mysql (name: example),

map the database tables to php classes, and then configure smarty for the presentation tier for the user. here

are those steps in more detail:


创建工作环境

创建一个叫做dataobjects的目录.

 

从命令行安装pear::db_dataobject,键入:
>pear install date


 


关键字 本文所属关键字

相关 与本文相关文章

分类 所有文章关键字导航

源码编程相关

Java   Asp   PHP   .Net   XML   C/C++   CGI   VB   Jsp   J2ee   J2se   J2me   EJB   Servlet   Tomcat   Resin   Struts   Weblogic   Eclipse   ANT   GUI   JMS   Web servise   IDEA   Webphere   Hibernate   Spring   Jboss   Applet   Swing   Socket   Javamail   Perl   Ajax   P2P   安全   模式   框架   测试   开源   游戏

SQL数据库相关

My-SQL   Ms-SQL   Access   DB2   Oracle   Sybase   SQLserver   索引   存储过程   加密   数据库   分页   视图  

手机无线相关

3G   Wap   CDMA   GRPS   GSM   IVR   彩信   短信   无线   增值业务

网页设计制作相关

HTML   CSS   网页配色   网页特效   Javascript   VBscript   Dreamweaver   Frontpage   JS   Web   网站设计

网站建设推广相关

建站经验   网站优化   网站排名   推广   Alexa

操作系统/服务器相关

Windows XP   Windows 2000   Windows 2003   Windows Me   Windows 9.x   Linux   UNIX   注册表   操作系统   服务器   应用服务器

图形图像多媒体相关

Photoshop   Fireworks   Flash   Coreldraw   Illustrator   Freehand   Photoimpact   多媒体   图形图像

标准 网站致力的规范

Valid CSS!

无不良内容,无不良广告,无恶意代码

Valid XHTML 1.0 Transitional

creativecommons