Blog: limiting number of posts per page

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

By NigelGordijk - May 22, 2009

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: [Damon] Blog: limiting number of posts per page

By NigelGordijk - May 22, 2009

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: [NigelGordijk] Blog: limiting number of posts per page

By Damon - May 22, 2009

Hi Nigel,

The best way to link to earlier articles is to setup prev and next links at the bottom of the blog index page.

When you generate code for the Blog section index (List page), in the View Options under "How Many", select the radio button for Show "5" records per page with prev & next page links.

This will generate the code to use. This is the part of the code that will generate the previous and next page links:

<?php if ($blogMetaData['prevPage']): ?>
<a href="<?php echo $blogMetaData['prevPageLink'] ?>">&lt;&lt; prev</a>
<?php else: ?>
&lt;&lt; prev
<?php endif ?>

- page <?php echo $blogMetaData['page'] ?> of <?php echo $blogMetaData['totalPages'] ?> -

<?php if ($blogMetaData['nextPage']): ?>
<a href="<?php echo $blogMetaData['nextPageLink'] ?>">next &gt;&gt;</a>
<?php else: ?>
next &gt;&gt;
<?php endif ?>


Let me me know how this works out for you.
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

By NigelGordijk - May 22, 2009

Great stuff! Thanks for your help.
Nigel Gordijk

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