Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/05/2014, 04:18
alkanet25
 
Fecha de Ingreso: mayo-2014
Ubicación: Inglaterra
Mensajes: 4
Antigüedad: 9 años, 11 meses
Puntos: 0
Zend paginator

Hola buenas,

estoy montando un sitio con zend 2.3 y estoy intentando paginar los resultados de una busqueda, pero me tira error al pulsar en cualquier enlace de la paginacion, me muestra los enlaces correctamente, los registros tb correctamente, pero al pulsar en cualquier link de la paginacion salta el siguiente error:

Código BASH:
Ver original
  1. Additional information:
  2. Zend\View\Exception\RuntimeException
  3. File:
  4. C:\xampp\htdocs\blog\vendor\zendframework\zendframework\library\Zend\View\Helper\PaginationControl.php:51
  5. Message:
  6. No paginator instance provided or incorrect type.

Me da que el problema esta en el archivo de configuracion, tengo otra paginacion en este sitio y no me da ningun problema. Este es mi código.

module.config:

Código PHP:
Ver original
  1. 'tools'=>array(
  2.                  'type'=>'Segment',
  3.                     'options'=>array(
  4.                         'route' => '/tools[/[:action][/:id][/:id2]]',
  5.                         'constraints' => array(
  6.                                 'action'  =>  '[a-zA-Z][a-zA-Z0-9_-]*',
  7.                         ),
  8.                         'defaults'  =>  array(
  9.                                 'controller' => 'Application\Controller\Tools',
  10.                                 'action'     => 'index'
  11.                         ),
  12.                     ),
  13.             ),

Controller (ToolsController.php):

Código PHP:
Ver original
  1. public function searchAction()
  2. {
  3. ...................
  4. $paginator = new \Zend\Paginator\Paginator(new  \Zend\Paginator\Adapter\ArrayAdapter($searchData));
  5.              $paginator->setCurrentPageNumber($page)
  6.                       ->setItemCountPerPage(3)
  7.                       ->setPageRange(4);
  8.                                                    
  9. $view = new ViewModel(array('paginator' => $paginator));
  10. return $view;
  11. }

Layout (search_layout.phtml):

Código PHP:
Ver original
  1. <div class='icons-pagenate'>
  2.  
  3. <a href="<?php echo $this->url('tools', array('action'=>'search','id' => $this->first)); ?>">First </a>  
  4.  
  5. <?php if (isset($this->previous)){ ?>
  6.  
  7. <a href="<?php echo $this->url($this->route, array('action'=>$this->action,'id' => $this->previous)); ?>">
  8.  
  9.     &lt; Prev
  10. </a>
  11.  
  12. <?php }else{ ?>
  13.         <span class="disabled">&lt; Prev</span>
  14. <?php } ?>
  15.  
  16. <?php foreach ($this->pagesInRange as $id){ ?>
  17.   <?php if ($id != $this->current){ ?>
  18.     <a href="<?php echo $this->url($this->route, array('action'=>$this->action,'id' => $id)); ?>">
  19.         <?php echo $id; ?>
  20.     </a>
  21. <?php }else{
  22.      echo $id;
  23.      }
  24. } ?>
  25.  
  26. <?php if (isset($this->next)){ ?>
  27.   <a href="<?php echo $this->url($this->route, array('action'=>$this->action,'id' => $this->next)); ?>">
  28.     Next &gt;
  29.   </a>
  30.  
  31. <?php }else{ ?>
  32.   <span class="disabled">Next &gt;</span>  
  33. <?php } ?>
  34.   <a href="<?php echo $this->url('tools', array('action'=>'search','id' => $this->last)); ?>"> Last</a>
  35.   </div>

View:
Código PHP:
Ver original
  1. <?php echo $this->paginationControl($this->paginator,'Sliding','layout/search_layout', array('route' => 'tools','action'=>'search')); ?>

A que puede ser debido?? Qué estoy haciendo mal?
Gracias y saludos