Forum

Thread tagged as: Question, Problem

Perch Content Custom coming up empty on paginated pages

I've got some sections of a website I'm developing for a client.

The pages are basically

  • perch content create at the top to create the section
  • perch content custom in the body to display the most recent item
  • perch content custom in the sidebar to display a list of all posts and link to them

This works on the first page but as soon as you click to one of the other posts, the sidebar no longer shows any other pages. Does anyone know what I'm doing wrong?

With the 'page' option I've tried '/*', nothing and the main root page '/women-in-business.php' but no links come up on any of the inner pages. Here are some links that show what I mean - if you click on the section on the right you get the previous posts as dropdowns.

https://lincolns.crushme.com.au/women-in-business.php https://lincolns.crushme.com.au/women-in-business.php?page=3 https://lincolns.crushme.com.au/business-profile.php

It's kind of working on the live site but only pages from the current url show up

https://www.lincolns.com.au/women-in-business.php https://www.lincolns.com.au/women-in-business.php?page=3

Bruce Reynolds

Bruce Reynolds 0 points

  • 7 years ago

Bruce, To fully understand your problem it would be best if you post your template. Also, if your output html is not what you were expecting, please post that output and explain what html you were expecting. Thanks.

Drew McLellan

Drew McLellan 2638 points
Perch Support

It sounds like you've got two lists both using the same pagination variable name. When one goes onto page 2, both do.

You can fix that by changing the pagination-var option on one of the listings. By default it's page.

I've tried to set the pagination var and the sidebar just didn't create any links to the pages. Here's an outline of the code

main page

<?php perch_content_create('Women In Business Article', array(
    'template' => 'women-in-business.html',
    'multiple' => true,
    'edit-mode' => 'listdetail',
    'sort' => 'article-date',
    'sort-order' => 'DESC',
    'searchable' => true,
)); 
?>

at the top of the page

<?php perch_content_custom('Women In Business Article', array(
            'paginate'=> true,
            'count'=> 1,
            'sort'=> 'article-date',
            'sort-order'=>'DESC',
            'paginate'=> false,
            'pagination-var ' => 'wib',
)); ?>

to create the main article of the post

 <?php perch_layout('wib-previous-sidebar') ?>

is the sidebar layout and in that is

<div class="module-tight blue-5-border fade previous-articles">
     <h3 class="content-dropdown">Previous Women In Business ↓</h3>
     <div class="previous-dropdown">
          <?php perch_content_custom('Women In Business Article', array(
                'page'=>'/women-in-business.php',
                'template' => 'wib-previous-template.html',
                'paginate'=> false,
                'pagination-var' => 'archive',
                'count'=> 60,
                'sort'=> 'article-date',
                'sort-order'=>'DESC',
                )); ?>   
    </div>

</div>

and I've tried that with and without page variables. Without I get a link but no more items on the inner pages. Below is what I have in wib-previous-template.html I think there's a problem with what I have for the href

<perch:content id="article-date" type="date" label="Article Date - Used for ordering" suppress="true" required="true" />
<a href="<perch:content id="_page" />" class="no-underline"><h3><perch:content id="name" type="text" label="Name" /></h3>
<p><perch:content id="company-name" type="text" label="Company Name" /></p></a>

Thanks, it's been driving me crazy and I have 3 sections of the website where I create and show content in the same way and they all have the same problem! When I built the site I didn't know much about blog and it wasn't that fully featured but I think if I was doing it now these sections would have worked much better as blog templates and categories!

I've been trying various attempts with page variables on some, not on others and anything else I can think of and it's working on this page

https://lincolns.crushme.com.au/business-profile.php

but not this one

https://lincolns.crushme.com.au/women-in-business.php

Even though the code for each is exactly the same. By using different page variables for each I've managed to get the list of previous women in business articles to show up on the other pages like with the client profile but the links don't show up with the numbers after the ?page=

https://lincolns.crushme.com.au/women-in-business.php?page=7 - that was manually entered and the other articles show up but no links.

So I've figured out that the reason it was working on the other page was that I had added some javascript that adds the consecutive numbers after the page variable ?page= so the links worked. Obviously this is quite hacky and was only meant to be temporary. Is it possible to get the full url for content bought in via content custom? I was using content id="_page" but that only give the main url, not the individual page.

Thanks

Drew McLellan

Drew McLellan 2638 points
Perch Support

The individual page is dependant on sorting and filtering, so that's the best we've got.