Recent Topics

1 Aug 31, 2007 10:11    

Hi all,

Now that Archive has been made a plugin, I'm having trouble finding how to do this : I'd like the "Archives" block on my page to skip the N first posts Actually, I'd like to control it fully but my main goal is to skip the exact number of posts displayed on the main page. I can set it manually, but of course it would be even better if I knew how to get this number automatically from the config variable...

Any help ?

3 Aug 31, 2007 13:34

It is not the right variable, you don't indicate the right page and you give absolutely no direction whatsoever on how I'm supposed to use the info you are giving.

I'm really sorry and thank you for trying to help, Afwas, but this is no use to me... :-/

4 Aug 31, 2007 13:51

It is the right variable. If you did the search you might have found [url=http://doc.b2evolution.net/v-0-9/__filesource/fsource_admin__blogsadmin_edit_showposts.php.html]this page[/url] where there's a piece of code, starting at line 59 where it does someting similar to what you want:

#
    // Get the posts to display:
    $MainList = & new ItemList( $blog, $show_statuses, $p, $m, $w, $cat, $catsel, $author,
 $order, $orderby, $posts, $paged, $poststart, $postend, $s, $sentence, $exact, $preview, '', '', $timestamp_min, $timestamp_max );

    $posts_per_page = $MainList->posts_per_page;


and:


    if( !$poststart )
    {
        $poststart = 1;
    }
    if( !$postend )
    {
        $postend = $poststart + $posts - 1;
    }
    $nextXstart = $postend + 1;
    $nextXend = $postend + $posts;

Good luck

5 Aug 31, 2007 15:13

ok. First, there's no need to be harsh on a user who's trying but not succeeding. Especially if that user just thanked you.

Second, as far as I can grasp something here, seems like $posts_per_page either contains how many posts are displayed on main page (which is good, I need this information) or the number of items displayed in the archive list (which I don't really need right now).

What I want to to is make the list START further than last post. Meaning I should change something like $poststart or I don't know what.

So I tried this

$Plugins->call_by_code( 'evo_Arch', array( // Add parameters below:
		'posts_per_page' => 5, // then later change to $MainList->posts_per_page,
		) );

and this

$Plugins->call_by_code( 'evo_Arch', array( // Add parameters below:
		'poststart => 5, // then later change to $MainList->posts_per_page,
		) );

...to no avail. And from what I can get when looking at the plugin code, what I'm trying to do is not possible. Too bad, it would just require to include a LIMIT clause in the SQL, but the request is called within an object and I don't want to hack all of it.

So, again, thank you Afwas (and please don't just flame me because I'm thanking you) but either the information given in this thread is not helpful or I'm just totally stupid (which you seem to think, but I do not of course).

6 Aug 31, 2007 17:56

exess wrote:

ok. First, there's no need to be harsh on a user who's trying but not succeeding. Especially if that user just thanked you.

Afwas isn't renowned for his harshness, and not everybodys first language is english huh ? ;)

You might find [url=http://forums.b2evolution.net/viewtopic.php?t=11375&highlight=archives]this post[/url] a starting point, the solution had some flaws but I never bothered following them up and curing them.

¥

7 Aug 31, 2007 19:13

Perfect solution. I see what flaws it could have but it's working well enough for me here. Thanks ¥åßßå and sorry for getting upset. And really, Afwas, thanks you too and sorry we couldn't get to understand each other (my first language is french, btw).

Cheers all and thank you.

8 Sep 01, 2007 03:03

Never mind the words used, I wasn't in my most friendly mode either.
I read your original question as follows:

if I knew how to get this number automatically from the config variable...

and my answer was: the variable is: $posts_per_page. As I showed in my second post they got to $nextXstart which is basically the number of the first post on the second page.

My question is this: why isn't $Settings->posts_per_page a number I can call wherever I like. If the class Settings isn't global, what is? This is me not understanding the basic principles of OO in php and that is one of the reasons I didn't give you the complete answer you were hoping for.

Glad you sorted it out and I wish you a lot of fun with your blog and with B2evo in general.

9 Sep 01, 2007 18:45

Thanks a lot Afwas, and for the record, I can't understand why this is not globally accessible too... And if I may add, it would be very useful to have a bit more documentation about the use of the API by the plugins. A simple list of available variables (parameters) you can pass and what they basically do... I went to http://doc.b2evolution.net/v-1-10/plugins/archives_plugin.html and ok this is well documented if you want to program with it, but if you just want to call it with parameters, it's a bit too few...

Anyway, b2evo is great and aside from occasional trouble (essentially when updating) it's easy and cool to use. B)

Thanks all !


Form is loading...