douzoudang1511 2014-03-11 11:05
浏览 49
已采纳

如何创建自定义Zend Paginator适配器(Zend框架1)

I'm working on implementing pagination with Zend framework 1.12, data mappers, and a mysql database.

I'm working off this example: http://akrabat.com/zend-framework/exploring-zend-paginator/ My question is how to create this with the zf tools. Specifically, I can create my adapter class by manually creating the files, but I get a fatal error that the adapter is not found. I think this has to do with the .zfproject.xml. Is there a zf command that I can use or how should I update the .zfproject.xml file?

  • 写回答

1条回答 默认 最新

  • dongyingjiu0669 2014-03-11 13:24
    关注

    Is your error regarding $ this-> getDbAdapter ()?
    If yes, try to replace $db = $this->getDbAdapter(); by

    $db = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('db') ;
    

    With in application.ini something like :

    resources.db.adapter = PDO_MYSQL
    resources.db.params.host = localhost
    resources.db.params.username = XXX
    resources.db.params.password = YYYY
    resources.db.params.dbname = db-name
    

    Regarding change .Zfproject.xml, I think it's a bad idea.
    The zf.bat is a tool box but if you want to do something more complicated, it is better not to use it and understand how Zend. (even if it is not necessarily obvious at first :))

    good luck! :)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部