We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum

Forum

Thread tagged as: Problem

Blog list page 2 loses recent posts links

Hi

I've got a sidebar in a blog displaying recent posts. All is fine until you go to page 2 of the pagination. The recent list then disappears.

I'm reusing code I've used elsewhere but I cannot get this to work on this site. I am using sections this time. But I've tried it without the sections without success. I've also tried it with the default blog templates and disabled any htaccess trickery. All fail to bring back the recent posts list once you browse to the second page of results. I've tried adding <perch:showall> but it doesn't return anything to the page beyond page 1 of the paginated results.

Many thanks in advance. Teething baby wailing in the background so sorry if I'm being really thick here. My brain is fried!

My three files are:

Index.php


<?php perch_blog_custom(array( 'count'=>'2', 'section'=>"projects", 'template'=>'post_in_list.html', )); ?>

global.sidebar.php


<?php perch_blog_custom(array( 'count' => 3, 'template' => 'posts_recent.html', 'section' => 'projects', 'sort' => 'postDateTime', 'sort-order' => 'DESC', )); ?>

posts_recent.html


<perch:before> <ul></perch:before> <li><a href="<perch:blog id="postURL" />" rel="bookmark" class="entry-title"><perch:blog id="postTitle" /></a></li> <perch:after></ul> </perch:after>

I've noticed in the debug message that the template on page 2 fails to bring in the first line of the sql query.

First page:


0.0816 0.0012 Using template: /templates/blog/posts_recent.html 0.0819 0.0003 SELECT * FROM perch2_blog_sections ORDER BY sectionTitle ASC 0.0834 0.0015 SELECT * FROM perch2_blog_sections WHERE sectionSlug='projects' LIMIT 1 0.0836 0.0002 SELECT year(postDateTime) as year, COUNT(*) AS year_qty FROM perch2_blog_posts WHERE postStatus='Published' AND postDateTime<='2015-05-06 17:22:00' AND sectionID='2' GROUP BY year ORDER BY year DESC

Second page:


0.073 0.0018 Using template: /templates/blog/posts_recent.html 0.0736 0.0006 SELECT * FROM perch2_blog_sections WHERE sectionSlug='projects' LIMIT 1 0.0739 0.0003 SELECT year(postDateTime) as year, COUNT(*) AS year_qty FROM perch2_blog_posts WHERE postStatus='Published' AND postDateTime<='2015-05-06 17:22:00' AND sectionID='2' GROUP BY year ORDER BY year DESC

My diagnosis report is:


Perch: 2.8.6, PHP: 5.5.22, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 15d5c781cfcad91193dceae1d2cdd127674ddb3e $, with PDO Server OS: Darwin, apache2handler Installed apps: content (2.8.6), assets (2.8.6), categories (2.8.6), perch_blog (4.6), perch_forms (1.8.3), perch_mailchimp (2.0.1) App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_blog', 'perch_forms', 'perch_mailchimp', ); PERCH_LOGINPATH: /perch PERCH_PATH: /Users/ellimondo/Dropbox/Sites/embersfireplaces/dev.embersfireplaces.co.uk/perch PERCH_CORE: /Users/ellimondo/Dropbox/Sites/embersfireplaces/dev.embersfireplaces.co.uk/perch/core PERCH_RESFILEPATH: /Users/ellimondo/Dropbox/Sites/embersfireplaces/dev.embersfireplaces.co.uk/perch/resources Image manipulation: GD PHP limits: Max upload 32M, Max POST 32M, Memory: 128M, Total max file upload: 32M Resource folder writeable: Yes HTTP_HOST: dev.embersfireplaces.co.uk DOCUMENT_ROOT: /Users/ellimondo/Dropbox/Sites/embersfireplaces/dev.embersfireplaces.co.uk REQUEST_URI: /perch/core/settings/diagnostics/ SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
Jonathan Elliman

Jonathan Elliman 27 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Both listings will be responding to the same pagination. Blog listings are paginated by default. Try setting it to false on the list you don't want to paginate.

Thanks Drew. I had tried this but stupidly put 'false' in quotes and then discarded the idea.