Jump to content

Pagination Issue


Jon
 Share

Recommended Posts

Hello All,

I have setup a blog and added pagination to it with Pager (Pagination) Navigation I have followed the Docs. However when I click on the next page the page just reloads but the blog posts do not change. news/?page=2 etc is added to the URL but the results stay the same any ideas? The code Iam using is below.

Cheers

Jon

 

  <?php
$results = $pages->find("template=news-item|news-item-right-gallery, limit=2, sort=-news_date");
$pagination = $results->renderPager();

foreach($results as $result) {?>

  <div class="news-article">
        <div class="row">
         <div class="medium-3 columns">
         <?php if($result->single_image)
         $large = $result->single_image->width(150);
         $small = $result->single_image->width(590);
         echo "<img data-interchange='[{$small->url}, small], {$small->url}, medium], {$large->url}, large]'>";?>
        </div>
        <div class="medium-9 columns">
  <?php
    echo "<h2><a class='title' href='{$result->url}'>{$result->title}</a></h2>";
    echo "<p class='published'><i class='fa fa-calendar' aria-hidden='true'></i> On - {$result->news_date}</p>";
    if ($result->excerpt) {
      echo $result->excerpt;
    }else{
      echo $result->body;
    }
    ?>
    <a href="<?php echo $result->url ?>" class="button small">Read More</a>
    </div>
  </div>
</div>
    
<?php }
echo $pagination;   
?>

 

Link to comment
Share on other sites

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
 Share

×
×
  • Create New...