Recent Topics

1 Mar 11, 2007 23:13    

My b2evolution Version: 1.9.x

Different blog authors want to set the posts per page differently. It makes sense for some to have 5 or even 20 posts per page, but others (who do longer posts) sometimes wish to have only one 1 post per page. That's a reasonable request. Every blog situation is unique when it comes to the number of posts per page that looks right and is functional for readers.

I was quite surprised to find that the "posts per page" setting is only a global variable (I hope I'm wrong).

I found this in the _itemslist.class.php file:

In a section with this heading, "function ItemList(," these appeared:
$order = '', // ASC or DESC
$posts_per_page = '', // # of posts to display on the page

In my stub file for a specific blog I can have this

$order = 'ASC';

and it works to control that particular blog and override what is set in the index.php.

But, when I put this into the same stub file:

$posts_per_page = '10';

... that doesn't do a thing to change the global setting which I have set in the back office.

Here is my question:
Would there be a way that I could include some variation of that posts_per_page code in a stub file that would work (like the order code does) in that blog? If that is possible, how would I write it?

Sam

3 Mar 12, 2007 14:19

That's it. Thanks a million ¥åßßå. I knew you would know the answer. Even though I figured out that some "parameter" should go in the stub file and I saw "Posts" listed in the URL parameters in the manual (right along with Order), I failed to make the connection for the correct syntax. But, all's well that ends well, and we have a solution.

For those who would like a summary:

To control the number of posts in any blog:

a. create a stub file for that blog (see manual about how to create and use stub files).
b. set the value for number of posts per page by entering:

$posts = 10;  //set for any number of posts per page

What a great feature this is. I will mark it solved.


Form is loading...