0
我想在jQuery的移動框架中使用zend實現分頁。我有以下的代碼已經從控制器採取zend中沒有paginator實例提供或不正確的類型?
...
$message_list = $this->help->browse($browseArray);
$this->view->vCount = count($message_list);
$paginator = Zend_Paginator::factory($message_list);
$page = ($postData['page'] > 0) ? $postData['page'] : 1;
$paginator->setCurrentPageNumber($page);
$paginator->setItemCountPerPage(10);
$paginator->setPageRange(5);
$this->view->message_list = $paginator;
....
我也採取下面的模板頁面代碼,
....
<ul data-role="listview" data-theme="e">
<?php foreach ($this->message_list as $key => $value) { ?>
<li>
<img src="<?php echo BASE_URL; ?>public/common/images/mobile/jqueryMobile200Thumb.jpg" alt="" />
<h3><a href="<?php echo $this->url(array("controller" => "help", "action" => "dohelp", "id" => $value['helpid'])); ?>"><?php echo $value['title']; ?></a></h3>
<p><?php echo $value['content']; ?></p>
</li>
<?php } ?>
<li>
<?php echo $this->paginationControl($this->message_list, 'Sliding', 'pagination.phtml'); ?>
</li>
</ul>
....
,當我跑的網站,我得到了以下異常
Exception information:
Message: No paginator instance provided or incorrect type
Stack trace:
#0 [internal function]: Zend_View_Helper_PaginationControl->paginationControl(NULL, 'Sliding', 'pagination.phtm...')
#1 C:\xampp\htdocs\test\library\Zend\View\Abstract.php(350): call_user_func_array(Array, Array)
#2 C:\xampp\htdocs\test\application\mobile\views\scripts\help\messagelist.phtml(32): Zend_View_Abstract->__call('paginationContr...', Array)
#3 C:\xampp\htdocs\test\application\mobile\views\scripts\help\messagelist.phtml(32): Zend_View->paginationControl(NULL, 'Sliding', 'pagination.phtm...')
#4 C:\xampp\htdocs\test\library\Zend\View.php(108): include('C:\xampp\htdocs...')
#5 C:\xampp\htdocs\test\library\Zend\View\Abstract.php(888): Zend_View->_run('C:\xampp\htdocs...')
#6 C:\xampp\htdocs\test\library\ZC\Controller\Plugin\Mobile.php(54): Zend_View_Abstract->render('help/messagelis...')
#7 C:\xampp\htdocs\test\library\Zend\Controller\Plugin\Broker.php(287): ZC_Controller_Plugin_Mobile->dispatchLoopStartup(Object(Zend_Controller_Request_Http))
#8 C:\xampp\htdocs\test\library\Zend\Controller\Front.php(928): Zend_Controller_Plugin_Broker->dispatchLoopStartup(Object(Zend_Controller_Request_Http))
#9 C:\xampp\htdocs\test\library\Zend\Application\Bootstrap\Bootstrap.php(97): Zend_Controller_Front->dispatch()
#10 C:\xampp\htdocs\test\library\Zend\Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#11 C:\xampp\htdocs\test\index.php(34): Zend_Application->run()
#12 {main}
....
我在這做錯了什麼。請幫助我。
謝謝,仍然得到相同的錯誤... – mymotherland 2012-04-12 07:32:24
然後什麼var_dump($ this-> message_list)返回? – Vytautas 2012-04-12 07:35:48
var_dump($ this-> message_list)返回NULL.its很奇怪。如果我刪除代碼$ this-> paginationControl($ this-> message_list,'Sliding','pagination.phtml'),那麼我得到結果 – mymotherland 2012-04-12 07:39:54