Recent Topics

1 Jan 25, 2008 06:26    

My b2evolution Version: 2.4.0

Hi

Is it possible to set a specific number of posts per page for each category separately?

cat1 - 4 posts
cat2 - 1 post

Thanks

2 Feb 13, 2008 09:01

I put this in blog1.php and it works fine, but not for 'extra path' urls .

$a = $_GET['cat'];

if ($a == 1) $posts = 4;

We should better check the cat_ID, but it doesn't work like this

if ($cat_ID == 1) $posts = 4;

Any ideas?

3 Feb 13, 2008 18:34

you *might* be able to add your code to conf/_hacks.php ( just create the file and it's auto included ..... just not sure if it's included at the right point )

¥

4 Feb 13, 2008 19:08

Doesn't work when I put this in _hacks.php

if ($cat_ID == 1) $posts = 4;

Do you think this is the right code, but included in the wrong place?

6 Feb 13, 2008 19:30

No luck. The simple $posts = 1; doesn't work in _hacks.php

7 Feb 13, 2008 19:33

ok, that means that _hacks.php is called to late ... unfortunately /conf/_config_TEST.php is called to early so you're probably limited to hacking /inc/_blog_main.inc.php

¥

8 Feb 13, 2008 19:56

I put the code between functions and get

Undefined variable: cat_ID

10 Feb 13, 2008 20:44

No more errors, but still doesn't work.

11 Feb 13, 2008 20:53

¥åßßå wrote:

try $cat

¥

12 Feb 13, 2008 21:11

Nothing.

Maybe I must put it inside a function.

13 Feb 14, 2008 04:27

Thank you guys for help, but I can't get it done.

I believe it would be great to have this option in features list.

Just imagine you have 2 categories News and Products.

All posts in News are short (like a couple sentences and a link to the new product)

All posts in products are ten times longer (have full description, pictures and docs)

How many posts per page would you set in backoffice in this way? ;)

14 Feb 14, 2008 05:16

I'd use multiblogs and post the long stuff in a blog that only gets one post displayed and the short stuff in a blog that gets many posts displayed.

I mean, if I wanted to do something like that I'd use multiblogs for it ;)

15 Feb 14, 2008 08:05

This is what I'm gonna do if there is no other way :(

16 Feb 15, 2008 13:31

inc/_blog_main.inc.php approx 442 :

// Trigger plugin event:
// fp> TODO: please doc with example of what this can be used for
$Plugins->trigger_event( 'BeforeBlogDisplay', array('skin'=>$skin) );
switch( $cat )
{
  case 1:
    $posts = 1;
    break;

  case 2:
   $posts = 10;
   break;
}

¥

17 Feb 15, 2008 14:55

Perfect!!!

We just need to add global $cat; for pages and msg form.

Thank you!


Form is loading...