Forum

Thread tagged as: Problem, Blog

Pagination Issue with Blog

I'm having issues getting pagination working with the Blog add on.

I have the following code and this display pagination but when clicked the page changes but the articles do not update?

I also need to display all articles but when I remove the count the pagination doesn't display?

Any guidance would be great?

Thanks

Post.php

This is at the top of the template

This is at the top of the template
<?php
  $post_slug = perch_get('s');
?>
<h1><?php perch_blog_post_field($post_slug, 'postTitle'); ?></h1>
<?php perch_blog_post_field($post_slug, 'postDescHTML'); ?>

        <?php
          perch_blog_custom(array(
            'template' => 'in-pagination.html',
            'paginate' => true,
            'count' => 2,
          ));
        ?>

In-pagination.html

<perch:after>
  <div class="post-finish-img post-inner-nav">
    <perch:if exists="paging">

      <perch:blog id="page_links" encode="false" />
      <perch:if exists="not_first_page">
          <div class="btn-container">
              <a href="<perch:blog id="prev_url" encode="false" /> ">Previous</a>
          </div>          
      </perch:if>
      <perch:if exists="not_last_page">
          <div class="btn-container">
              <a href="<perch:blog id="next_url" encode="false" /> ">Next</a>
          </div>            
      </perch:if>

    </perch:if>
  </div>
</perch:after>
Luke Jennings

Luke Jennings 0 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you post your diagnostics report?

Health check
 Setup folder is present and should be deleted
 Perch is up to date
 PHP 5.6.36 is up to date
 MySQL 5.1.73 is up to date
 Image processing available
 File upload size is low. You can only upload files up to 2M.

Summary information
Perch: 3.1.1, PHP: 5.6.36, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $, with PDO
Server OS: Linux, cgi-fcgi
Installed apps: content (3.1.1), assets (3.1.1), categories (3.1.1), perch_blog (5.6.1), perch_forms (1.11)
App runtimes: <?php $apps_list = array( 'perch_forms', 'perch_blog', ); ?>
PERCH_LOGINPATH: /perch
PERCH_PATH: -----PATH-TO-SITE/-----site-name/perch
PERCH_CORE: -----PATH-TO-SITE/-----site-name/perch/core
PERCH_RESFILEPATH: -----PATH-TO-SITE/-----site-name/perch/resources
Image manipulation: GD Imagick
PHP limits: Max upload 2M, Max POST 8M, Memory: 128M, Total max file upload: 2M
F1: 9fab42554990d2c203d599a6437edd2a
Resource folder writeable: Yes
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
REQUEST_URI: /perch/core/settings/diagnostics/
DOCUMENT_ROOT: -----PATH-TO-SITE/-----site-name
HTTP_HOST: -----site-name

Drew McLellan

Drew McLellan 2638 points
Perch Support

So you're paginating successfully, but your template doesn't output any posts.

Remove this:

<h1><?php perch_blog_post_field($post_slug, 'postTitle'); ?></h1> 
<?php perch_blog_post_field($post_slug, 'postDescHTML'); ?>

and put the fields in your template instead.

It is in the template - posts.php is the template for the page

      <div class="cell large-11 medium 11 small-11">  
        <div class="border-content">
          <div class="primary">
            <h1><?php perch_blog_post_field($post_slug, 'postTitle'); ?></h1>

            <?php perch_blog_post_field($post_slug, 'postDescHTML'); ?>

          </div>
        </div>

        <?php
          perch_blog_custom(array(
            'template' => 'insights-pagination.html',
            'paginate' => true,
            'count' => 2,
          ));
        ?>

      </div>
Drew McLellan

Drew McLellan 2638 points
Perch Support

No, in the insights-pagination.html template.

Any particular place (line of code) i should paste it in? I tossed it around and doesn't seem to fix the issue

Drew McLellan

Drew McLellan 2638 points
Perch Support

Have you tried with the default templates?