Ver Mensaje Individual
  #33 (permalink)  
Antiguo 16/02/2012, 18:39
Avatar de GatorV
GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 11 meses
Puntos: 2135
Respuesta: Paginator Zend Framework 2.0 beta

Claro de hecho lo puedes hacer igual, la diferencia es que ahora el plugin de paginationControl te permite establecer un script por defecto (por eso la llamada es estática) es como establecer el defaultAdapter de un DbTable.

Prueba hacerlo directamente como tu segunda llamada y funciona igual
Código PHP:
Ver original
  1. public function indexAction()
  2.     {
  3.         $albums = $this->getAlbumTable()->fetchAll();
  4.         $matches = $this->getEvent()->getRouteMatch();
  5.         $nPage = $matches->getParam('page', 1);
  6.        
  7.         //PaginationControl::setDefaultViewPartial('paginator.phtml');
  8.        
  9.         $paginator = Paginator::factory($albums);
  10.         $paginator->setDefaultItemCountPerPage(5);
  11.         $paginator->setCurrentPageNumber($nPage);
  12.         //$paginator->setView($this->getLocator()->get('view'));
  13.        
  14.         return array('albums' => $paginator);
  15.     }

View:
Código PHP:
Ver original
  1. <h1>Albums</h1>
  2. <ul>
  3. <?php foreach ($this->albums as $album) { ?>
  4.     <li><?php echo $album->album_id; ?> - <?php echo $album->album; ?></li>
  5. <?php } ?>
  6. </ul>
  7. <?php echo $this->paginationControl($this->albums, 'Sliding', 'paginator.phtml'); ?>

Saludos.