Zend Framework使用Zend_Paginator进行数据库交互和分页

来源:互联网 发布:mac大型游戏推荐 编辑:程序博客网 时间:2024/04/28 01:31

一、大概思路

1.1

(备注:具体配置和运行情况参考上一篇Ubuntu10.10 Zend FrameWork配置及helloworld显示)

二、创建数据库表

三、创建项目zf create project pager

3.1、将application/configs/application.ini下的

phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1

resources.frontController.params.displayExceptions = 1

设置为1,Zend Framework可以提供调试错误信息的显示。

四、创建控制器、视图

4.1、indexController

4.2、index.phtml视图

4.3、pagelist.phtml

4.4、Bootstrap.php(数据库连接)

如果连接出现mysql drivers not found,请检查是否安装了php5-mysql(在ubuntu下一般没有安装),到“新立德软件中心”安装

五、运行效果

六、总结

Zend_Paginator还算是个不错的工具,挺方便的。

运行环境:ubuntu 10.10、zend framework

七、源代码下载

源代码下载:http://files.cnblogs.com/yongfeng/pager.zip

 

知识共享许可协议

作品采用知识共享署名-非商业性使用 2.5 中国大陆许可协议进行许可。

原创粉丝点击