Blog: limiting number of posts per page

5 posts by 2 authors in: Forums > CMS Builder
Last Post: May 22, 2009   (RSS)

Hi, there.

I'm putting together a blog using CMSB: http://www.yallaf1.com/blog.php.

The first page of this section only needs to show the five most recent posts. Clicking on a headline link - for, say, http://www.yallaf1.com/blogDetail.php?1 - should only show a single post.

Does anyone know how to set up the blog - or any other multi-page section, for that matter - so that I can limit the number of (a) headlines that appear and (b) the number of posts that appear, whether it's five or only one?

Thanks!
Nigel Gordijk

Common Sense Design: User-focused Web design
Tel: 001 519 342 5348 | Web: www.commonsensedesign.net

Re: [NigelGordijk] Blog: limiting number of posts per page

By Damon - May 22, 2009

Hi Nigel,

To limit the number of posts that appear in an index use this code in to top part of your page:

'perPage' => '5',

Next, it appears that your blog.php and blogDetail.php pages are almost the indentical.

Does the blogDetail.php have a foreach loop for the content? It shouldn't so this would explain the additional article on the page.

Use the Code Generator for the blog to generate single page code to confirm the correct code.

To make it easy to check your blog post links are linking to the right page, try adding the "title" to the Filename Fields:
Admin > Section Editors > click modify for the Blog seciton, then click on the Viewer Urls.

I hope this helps.
Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Damon] Blog: limiting number of posts per page

Thanks, Damon. That works perfectly: http://www.yallaf1.com/blog.php.

Please can you point me to a tutorial that explains how I link to the rest of the posts? i.e. the index page for earlier articles.

regards,
Nigel Gordijk

Common Sense Design: User-focused Web design
Tel: 001 519 342 5348 | Web: www.commonsensedesign.net

Re: [Damon] Blog: limiting number of posts per page

Great stuff! Thanks for your help.
Nigel Gordijk

Common Sense Design: User-focused Web design
Tel: 001 519 342 5348 | Web: www.commonsensedesign.net