The CakePHP Blog Tutorial shows a pagination view of all Blog posts. If in the view mode of a blog entry, how would I show a previous/next link to the posts before and after this one? Rather than having an index page with all posts listed I would like to click in blog view from post to post
+1
A:
From the Manual:
find('neighbors', $params)
'neighbors' will perform a find similar to 'first', but will return the row before and after the one you request. Below is a simple (controller code)
Example:
function some_function() {
$neighbors = $this->Article->find('neighbors', array('fields' => 'id', 'value' => 3));
}
quantumSoup
2010-08-21 23:43:06
Thank you, this is what I'm looking for.But how would I show it in view.cpt, that is what is the code to use and display the function?
stargazer
2010-08-27 16:44:51
@star Pass the id of the neighbors to the view and display a link to them there.
quantumSoup
2010-08-27 17:05:05