antknight Posted March 7, 2013 Share Posted March 7, 2013 In one of my sections' news pages, paginated list of news items: $results = $page->children("limit=3, sort=-date"); $pagination = $results->renderPager(); echo $pagination; echo "<ul class='nav'>"; foreach($results as $result) { echo "<li><p><a href='{$result->url}'>{$result->title}</a><br /><span class='summary'>{$result->date}</span></p></li>"; } echo "</ul>"; echo $pagination; In the sidebar (from head.inc), list the latest 5 news items from that section: $news = $page->rootParent->find("template=news-item, limit=5, sort=-date"); foreach ($news as $newsitem) { echo "<li><a href='{$newsitem->url}'>{$newsitem->title}</a></li>"; echo "<span>{$newsitem->date}</span>"; } On the first news page the sidebar displays correctly, when you go to page 2 I would expect the same five news items to be displayed. Instead the next five news items are displayed. Likewise for page 3, the next five news items are displayed. Why is this happening? Link to comment Share on other sites More sharing options...
Joss Posted March 7, 2013 Share Posted March 7, 2013 Try using a more defined selector. $news = $pages->find("template=news-item, limit=5, sort=-date, parent=/newsparentpage/"); You might not even need the parent if the template is enough. Link to comment Share on other sites More sharing options...
Soma Posted March 7, 2013 Share Posted March 7, 2013 Add start=0 to the sidebar. 1 Link to comment Share on other sites More sharing options...
antknight Posted March 7, 2013 Author Share Posted March 7, 2013 Thanks Soma, and an explanation from Ryan from here Link to comment Share on other sites More sharing options...
Soma Posted March 7, 2013 Share Posted March 7, 2013 It's also mentioned on the pagination docu. http://processwire.com/api/modules/markup-pager-nav/ Link to comment Share on other sites More sharing options...
antknight Posted March 8, 2013 Author Share Posted March 8, 2013 It's also mentioned on the pagination docu. http://processwire.com/api/modules/markup-pager-nav/ Doh! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now