Cakephp: preserve custom routes parameters in paginator links


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. // EXAMPLE ROUTE DEFINITION
  2. Router::connect('/:microsite/sitios/*', array('controller' => 'sites', 'action' => 'index'), array('microsite' => '[a-zA-Z0-9\-]+'));
  3.  
  4. // VIEW CODE
  5. $paginator->options( array( 'url' => array_merge( array('microsite' => $_microsite['permalink'] ), $this->passedArgs) ) );
  6.  
  7. $paginator->hasPrev() ) echo '<li>'.$paginator->prev('« Sitios anteriores', array('escape' => false)).'</li>';
  8.  
  9. $paginator->hasNext() ) echo '<li>'.$paginator->next('Sitios recientes »', array('escape' => false)).'</li>';

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.