Recent Topics

1 Mar 11, 2007 16:59    

My b2evolution Version: 1.9.x

hi,

the setting "how many blog entries per page" resides in the general settings page in b2evo - does this mean, I can only set up all my blogs as single page view or none? I would like to be able to set up only one of my blogs to single page mode.

any chances here?

PAT

2 Mar 12, 2007 01:01

perler, I think that is a good request... you can see that I had asked exactly the same question in the Template, Skins forum:

http://forums.b2evolution.net/viewtopic.php?t=11124

My guess is that one of the real experts here has a "fix" for this dilemma. It is hard for me to fathom that there is only one "global" setting for posts per page, applying the same setting to all blogs. I am working to set up a multiple blog site which will have three authors other than myself doing their own unique editorializing, and upon soliciting them and showing them the application (while I am setting it up), all three asked exactly the same question, "Now, how to I set my blog for posts/per page, because I will want, (1 or 3 or 20 etc)." Based on posting characteristics (long or short ones) the posts per page requirements vary from author to author.

I will be checking both threads (this one and the one I started) with great interest. I am confident there is an expert out there (like ¥åßßå or personman) or an excellent hacker like Edb. Someone will know how to solve this.

Edited to add: The solution was provided by ¥åßßå . It is a simple parameter done in the stub file created for any blog. Check out the link to that thread which appears earlier in this post.

3 Mar 13, 2007 18:50

ah cool, so i finally must get into those stub files, i'll see. thanks,

PAT

4 Mar 13, 2007 19:39

btw, is there a way to have kind of an index in the sidebar for each article (automatically created) for easier navigation in an one article per page layout?

5 Mar 14, 2007 00:20

You might be able to do what you want without stubs. Something like this in the top of your skins/skinname/_main.php file:

<?php switch ( $blog ) {
case '1':
$posts = 5;
break;
case '2':
case '4':
$posts = 1;
break;
}


Maybe might work.

Anyway stubs are easy to deal with. Just little files that live in the installation's root and tell b2evo a few details about it's particular blog.

Try setting archives mode to days and see if that sets up your sidebar the way you want.

6 Mar 25, 2007 14:40

Edb (or others), I think you have an excellent concept here with the control of the posts/page being "skin specific." But, I tried that code you supplied and it didn't work. I set the app settings to allow posts/page at 9999 and then attempted to control by each skin's "_main.php" files. And I removed any post controlling code (e.g. $posts = 3; ) from stub files.

This is in an effort to create a better approach for printing by making a "printer friendly" skin based on a pared down build from the "basic" skin, but one which would have a different (more) number of posts per page than would be found in other skins available.

My objective here is to have a printer friendly skin allowing perhaps 20 posts per page. Thi would allow using a browser's print command to print out the blog in reasonable amounts. Switching back to the primary skin for attractive display (of course, might be many choices) would then show the blogs in the desired posts per page for better readability (even as low as 1).

So, I like the idea of controlling the posts/page skin by skin... but that code you offered doesn't produce any effect (comes out whatever I set as the default, whereas when I use the post controlling code in a stub file that does take precedence over the default). Is there a way to tweak that code Edb provided to make that "skin specific" posts/page concept work?

7 Mar 25, 2007 14:43

The posts per page has to be set before blog_main_inc is called, which means it either has to be done in a stub or index.php or hacks.php

¥

8 Mar 25, 2007 14:46

So... ¥åßßå, that means it can't be skin specific? Is that an unreasonable goal? Could there be some code in conf/hacks.php that would say, if the skin=printfriendly (or whatever skin name), then post/page is 30?

9 Mar 25, 2007 14:48

it would be "difficult" to make it skin specific

¥

10 Mar 25, 2007 14:50

Could there be some code in conf/hacks.php that would say, if the skin=printfriendly (or whatever skin name), then post/page is 30?

11 Mar 25, 2007 15:03

That would work as long as the skin name was in the url as a param, be a tad more faffing about to do the whole "is there a cookie, is the skin forced, what is the normal skin" route.

The easiest method is to change your printer friendly urls to add the posts param.

ie/http://domain.com/whatever_stub.php?tempskin=_printer&amp;posts=999

¥

12 Mar 25, 2007 15:04

Could there be something like this (of course, I mean real php code, not something just made up, by someone -me- who doesn't know php)?

$skin = "printfriendly";

if ( $skin == "printfriendly" ) {
    $posts=30!<br />";
}
$posts=default;

13 Mar 25, 2007 15:11

Of, course, now that I see your url solution, that is all I need. Thanks... I can again abandon my php coding attempts (I am only on chapter four in the "how you can be a php programmer in three weeks" book)...

14 Mar 25, 2007 15:14

You *could* try something like this in either your index.php or your hacks.php

$test = ( empty( $_POST['skin'] ) ? ( empty( $_GET[ 'skin' ] ) ? '' : $_GET['skin'] ) : $_POST['skin'] );
if( $test == 'your printer skin' ) $posts = 9999;

but it'll only work as long as your skin name is a param in the url ( ie/ page 2 etc would fail )

¥

15 Mar 25, 2007 15:32

This ¥åßßå code is working perfectly.... After all that experimentation, I had to clear my browser cache completely.

And I must say this does allow a very nice way to have a printer friendly set up (as I described as my objective).

This is a very nice hack. Edb also deserves praise for coming up with the concept "skin-specific" posts/page. A great idea with lots of uses.

Once again ¥åßßå is the world's greatest php master. Once again, "I tip me lid" to the "Killer expert!"


Form is loading...