Jump to content


jan

Member Since 15 Feb 2012
Offline Last Active Sep 04 2012 03:37 PM
-----

#10151 Pagination: Each page showing same content?

Posted by jan on 05 April 2012 - 08:20 AM

About 5 month later, I have nearly the same problem and can not explain to myself what's going on.

I want to use pagination on the homepage/ root page. I created a homepage template that displays articles from this structure:
/homepage/articles/article.
So I try to paginate all the single articles lying beneath "/homepage/articles/" (hope this is not confusing). It's
HOME

ARTICLES

Article 1

Article 2

Article 3

...


I was trying this code:

$results = $pages->find("template=article, limit=15, sort=title");

if(count($results)) {  
	$pagination = $results->renderPager(array(
		'nextItemLabel' => "next",
		'previousItemLabel' => "prev",
		'listMarkup' => "<ul class='MarkupPagerNav'>{out}</ul>",
		'itemMarkup' => "<li class='{class}'>{out}</li>",
		'linkMarkup' => "<a href='{url}'><span>{out}</span></a>"
	));  
	
	echo $pagination;

	echo "<ul>";
	foreach($results as $result) {
		echo "<li><p><a href='{$result->url}'>{$result->title}</a><br /><span class='summary'>{$result->articleDescription}</span></p></li>";
	}
	echo "</ul>";
	
	echo $pagination;

}

As result, I get the pagination navigation, but it's not working correctly. Clicking through the pages shows always the same results.

This query didn't work eather:
$results = $page->child("title=articles")->children("limit=5");

Any ideas? I was now trying for hours...