Jump to content

Recommended Posts

Posted
I'm currently working on a site that includes a blog. Individual blog posts can be assigned multiple "categories" using a Page field type in the post that references pages using the "category" template.
 
When I perform the following, the correct posts are displayed on each category page:
$posts = $pages->find( "parent=/blog/, template=post, categories=$page->name, start=0, limit=20, sort=-date" ); 
But, when I modify the code to limit the number of posts that are displayed, the same two posts display on every paginated page within a category:
 
$posts = $pages->find( "parent=/blog/, template=post, categories=$page->name, start=0, limit=2, sort=-date" ); 
My "category" template is set to "Allow Page Numbers" and the pagination is displaying on each paginated category page. But any posts beyond the first two never display.
 
It has been a long working Sunday and I'm sure that whatever I'm doing wrong is silly, but I'm too tired to see it!
Posted

Drop the "start=0" and you should be fine. (I'm on mobile, someone will give you a more detailed explanation soon I'm sure.)

Posted

@nik is (of course) right. The 'start=0' in your selector will force it to always show the first (in this case) 2 records, regardless of what the pagination module would normally produce. By removing 'start=0', the module can take control of which subset of records are produced.

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
×
×
  • Create New...