Skip to content

Instantly share code, notes, and snippets.

@marcincodes
Created November 10, 2013 12:59
Show Gist options
  • Save marcincodes/7397947 to your computer and use it in GitHub Desktop.
Save marcincodes/7397947 to your computer and use it in GitHub Desktop.
Router do paginacji
//routes.php
Router::connect(
'/forum/:id-:slug/*', // E.g. /blog/3-CakePHP_Rocks
array('controller' => 'forum', 'action' => 'show'),
array(
// order matters since this will simply map ":id" to $articleId in your action
'pass' => array('id', 'slug'),
'id' => '[0-9]+'
)
);
Router::connectNamed(false, array('separator' => '-', 'default' => true));
// View File
$this->Paginator->options(array('url' => array(
'controller' => $this->request['controller'],
'action' => $this->request->params['id'].'-'.$this->request->params['slug'],
)));
/Url: forum/id-slug/page-number
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment