Jump to content

Recommended Posts

Posted

I am using the following code on a page to get pagination that will be used by infinitescroll to append paginated pages to the current page.

Trouble I run into is that the pagination does not work properly, it just keeps adding/appending the same page over and over once I scroll to the bottom.

So there must be something that I am doing wrong with the pagination call, can anyone see my mistake:

<div id="wrapper" class="clearfix">
	<?php
    $limit = 7; // the "limit"-setting used on this page
    $results = $pages->find("template=blogpost-iframe, limit=$limit, start=0");
    foreach($results as $result) {
    $imgURL    		= $result->images->first()->url; // original image
		$thumbWidth		= 192;
		$thumbWidthPX	= $thumbWidth . 'px';
		$thumb			= $result->images->first()->size($thumbWidth);
		$thumbURL		= $thumb->url;
		$siteURL		= $pages->get(1)->httpUrl; // home URL
		$summary		= $result->summary;
		$title			= $result->title;
		$blogURL		= $result->httpUrl;
		$frontSummary	= $result->frontSummary;
    echo <<<BLOGEOF
<div class="tack">
  <div class="tackHolder">
    <div class="actions">
      <div class="left">
		<a class="button" href="http://pinterest.com/pin/create/button/?url=$siteURL/&media=$imgURL&description=$summary"><strong><em></em>Repin</strong></a>
	  </div>
      <div class="left">
        <div id="facebook_like_button_holder" >
             <a title="send to Facebook" href="http://www.facebook.com/sharer.php?s=100&p[title]=$title&p[summary]=$summary&p[url]=$blogURL&p[images][0]=$imgURL" target="_blank"><div id="fake_facebook_button" class="button"><strong><em></em>like</strong></div></a>
      </div>
    </div>
		</div>
    <a href="$blogURL" class="iframe cboxElement" title="$title"><img src="$thumbURL" alt="$title" title="$title" class="tack_img drthumbonly" width="$thumbWidthPX"/></a>
	</div>
	$frontSummary
	<p class="links"><a href="$blogURL" class="iframe cboxElement">Meer Informatie...</a></p>
</div>
BLOGEOF;
    }
    ?>
        </div>
</div><!-- #wrapper -->
<div class="clear"></div>
<nav id="page-nav">
<?php
$children = $page->children("limit=" . $limit);
$totalpages = ceil($children->getTotal() / $limit);
// PAGINATOR: set SEO tags for Google
if ($input->pageNum) {
    if ($input->pageNum < $totalpages) {
    echo "<a href='" . $page->url . $config->pageNumUrlPrefix . ($input->pageNum + 1) . "'>Next ";
    }
    else {
        echo "Thanks for browsing, you have reached the bottom of this page!";
    }
}
?>
</nav>

Thanks!

Posted

Found it already myself:

$results = $pages->find("template=blogpost-iframe, limit=$limit, start=0");

This threw the sytem off, I don't know why, but taking out start=0 did the trick. Would be nice to understand why and how this works, now I am guessing and through trial and error got to this solution.

Does anybody know how and why this works and what the underlying logic is?

thanks!

Posted

I also have a pagination issue here and created teh following test setup:

Essentially I have the following 6 pages:

About
Site Map
Admin
MyArticle
News
Gallery
 
 
the homepage template looks like this:
 
<?php
$results = $page->children("limit=3"); 
$pagination = $results->renderPager();
echo "<ul>";
foreach($results as $result) {
    echo "<li><a href='{$result->url}'>{$result->title}</a></li>"; 
}      
echo "</ul>";
echo $pagination;
The displayed result looks like this:
 
 
About
Site Map
Admin
1
2
Next
 
So the paginator is rendered properly, but when I now click on one pagination link the page just refreshes?
 
Do I have to implement the pagination logic myself using pageNum ?
 
~Marc

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...