Forum
Start not working on custom_cotent
Hi Guys,
I have the following code;
$page = intval($_GET["page"]);
if ($page < 2) { $count = 8; } else { $count = 9; }
perch_content_custom('Stories', [
'template' => 'stories/_combined',
'sort' => 'date',
'sort-order' => 'DESC',
'count' => $count,
'paginate' => true,
'page-links' => true,
'page-link-style' => all,
'start' => 9
]);
However the start value doesn't appear to be working no matter what I enter.
If I remove the paginate option then it works.
Any ideas?
Thanks, Terry
You can't both set the start position and ask pagination to do it. It's one or the other.
Ok. The problem I actually facing is this, if you have any ideas? So my templates are as follows;
What I am doing is setting the count to 8 on the first page as the first two items on he first page are bigger (like featured boxes) and span half and half, the other boxes then span in thirds. So on the first page I have a count of 8 to display 8 items to accommodate for the bigger feature boxes.
But on pages 2 and upwards I set the count to 9 as I want it to just display the _teaser template in columns of 3.
The problem I am facing is it is missing off item 9. So page 1 displays 1-8
But page 2 the first item is item number 10.
I am assuming because on page 2 it thinks the previous count has been 9 so therefore starts at position 10.
Any ideas on how I can resolve this?
Thanks.
Keep the count the same for all pages.
In the template, if it's page 1 don't output the first 2 items.
Sorry Drew, not sure I follow? I don't quote understand how I can show 8 items on page one and 9 on the other pages? Even if I exclude the first two. I have been playing around and not got anywhere.
Would you be able to elaborate on what you mean / the approach?
Thanks,
Just wonder if the URL might be useful so you can visually see what I am trying to do;
https://www.supershoes.org.uk/stories/
Thanks,
If it's page 1, test to see if you're on index 1 or 2. If you are, don't output the item.
If that's not working, show me your code and I can help debug it.
I managed to get around it with a little messy code - breaking the code out into separate blocks, pulling in the last article in the previous pagination and using the start parameter, then ignoring the last item. So a little convoluted and messy.
The site went live officially today so I really had to sort something.
I plan to come back and readdress this and will look at your suggestion Drew.
Thanks.