Ver Mensaje Individual
  #10 (permalink)  
Antiguo 15/02/2012, 17:31
Avatar de andresdzphp
andresdzphp
Colaborador
 
Fecha de Ingreso: julio-2011
Ubicación: $this->Colombia;
Mensajes: 2.749
Antigüedad: 12 años, 9 meses
Puntos: 793
Respuesta: Paginator Zend Framework 2.0 beta

Tomé uno de los que usaba en ZF1

Código PHP:
Ver original
  1. <?php if ($this->pageCount): ?>
  2. <div class="paginationControl">
  3. <?php echo $this->firstItemNumber; ?> - <?php echo $this->lastItemNumber; ?>
  4. of <?php echo $this->totalItemCount; ?>
  5.  
  6. <!-- First page link -->
  7. <?php if (isset($this->previous)): ?>
  8.   <a href="<?php echo $this->url(array('page' => $this->first)); ?>">
  9.     First
  10.   </a> |
  11. <?php else: ?>
  12.   <span class="disabled">First</span> |
  13. <?php endif; ?>
  14.  
  15. <!-- Previous page link -->
  16. <?php if (isset($this->previous)): ?>
  17.   <a href="<?php echo $this->url(array('page' => $this->previous)); ?>">
  18.     &lt; Previous
  19.   </a> |
  20. <?php else: ?>
  21.   <span class="disabled">&lt; Previous</span> |
  22. <?php endif; ?>
  23.  
  24. <!-- Next page link -->
  25. <?php if (isset($this->next)): ?>
  26.   <a href="<?php echo $this->url(array('page' => $this->next)); ?>">
  27.     Next &gt;
  28.   </a> |
  29. <?php else: ?>
  30.   <span class="disabled">Next &gt;</span> |
  31. <?php endif; ?>
  32.  
  33. <!-- Last page link -->
  34. <?php if (isset($this->next)): ?>
  35.   <a href="<?php echo $this->url(array('page' => $this->last)); ?>">
  36.     Last
  37.   </a>
  38. <?php else: ?>
  39.   <span class="disabled">Last</span>
  40. <?php endif; ?>
  41.  
  42. </div>
  43. <?php endif; ?>

El error anterior se solucionó con lo que me dió masterpuppet

Código PHP:
Ver original
  1. $paginator->setView($this->locator->get('view'))

con eso ya encuentra el items.phtml

Ahora me dice que:

Cita:
Warning: Route with name "" not found in \library\Zend\Paginator\Paginator.php on line 424
A que ruta se refiere y como se setea? algo más del di?

También me falta decirle en donde tiene que empezar, pero de ZF1 a ZF2 hay mucha diferencia. En ZF1 le decia:

Código PHP:
Ver original
  1. if ($this->_hasParam('page')) {
  2.      $paginator->setCurrentPageNumber($this->_getParam('page'));
  3. }

En el ZF2 no sé como sería.

Gracias GatorV
__________________
Si sabemos como leer e interpretar el manual será mucho más fácil aprender PHP. En lugar de confiar en ejemplos o copiar y pegar - PHP