2010年7月31日星期六

Re: [fw-db] Need help with Pagination

You have a typo in your code. 

Zend_Paginator_Adaptor_DbSelect

should be 
Zend_Paginator_Adapter_DbSelect

On 1 aug. 2010, at 00:07, Y D <dossany@gmail.com> wrote:

Hi,

I went through the TUTORIAL from Youtube and followed as exactly as it is. Following is the link for the video;

http://www.youtube.com/watch?v=f4fujot7Xlc


Even after understanding the logic in the video and following it exactly, Facing this problem;


Warning: include(Zend\Paginator\Adaptor\DbSelect.php) [function.include]: failed to open stream: No such file or directory in C:\wamp\www\ZCFPRD\library\Zend\Loader.php on line 136

Warning: include() [function.include]: Failed opening 'Zend\Paginator\Adaptor\DbSelect.php' for inclusion (include_path='C:\wamp\www\ZCFPRD\library;.;C:\php5\pear') in C:\wamp\www\ZCFPRD\library\Zend\Loader.php on line 136

Fatal error: Class 'Zend_Paginator_Adaptor_DbSelect' not found in C:\wamp\www\ZCFPRD\application\controllers\DocumentsController.php on line 2144


I face this problem quite often but it slips off my brain how to cater it. Can someone please explain to me why I face this problem and what exactly I should do when I face it.

Please find my code below;

////////******* code: start **********///////////


Controller Action:

public function trypaginatorAction(){
{

$GETDATA = new Model_Managers_Paginator();
$getdata = $GETDATA->simplepaginator();

$paginator = new Zend_Paginator(new Zend_Paginator_Adaptor_
DbSelect($getdata));
$paginator->setItemCountPerPage(25)
          ->setCurrentPageNumber($this->_getParam('page',1));
         
          $this->view->paginator = $paginator;

}





View:

<?php
foreach($this->paginator as $paginator){
    echo $paginator['DOCUMENT_ID'].' has Title: '.$paginator['SUBJECT'].'<BR>';
}

?>




Model:

<?php

class Model_Managers_Paginator{
   
    public function simplepaginator(){
  
        $db = Zend_Db_Table::getDefaultAdapter();
        $getdata = new Zend_Db_Select($db);
        $getdata->from('ARC_DOCUMENT')
        ->where('DELETED=0');
    }
}



?>



///////////*********** code: end ************///////////////////





Your earliest reply awaited


--
Regards,
YD

没有评论: