douzoudang1511 2014-03-11 19: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 21: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! :)

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

报告相同问题?

悬赏问题

  • ¥15 请问一下这个运行结果是怎么来的
  • ¥15 这个复选框什么作用?
  • ¥15 单通道放大电路的工作原理
  • ¥30 YOLO检测微调结果p为1
  • ¥20 求快手直播间榜单匿名采集ID用户名简单能学会的
  • ¥15 DS18B20内部ADC模数转换器
  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下