access postsPerPage and page in "post" or "message" template

Kintaro

Well-known member
Here it is a newbie question:

I need to calculate inside message template the position of posts in relation to number of post per page and of course the page number.

I need to do:
position - (postPerPage*(page - 1))
The question is:
How can I access $thread.postsPerPage and $thread.page inside message template?
 
Posts per page is a global option and the values of global options are available... globally :p

In a template, you can do:

{$xenOptions.messagesPerPage}

Bringing what you want to do together, this should work:

Code:
{xen:calc '{$message.position} - ({$xenOptions.messagesPerPage} * ({$page} - 1))'}

Note: I have assumed {$message} but it may depend on what template that is used in. If $message doesn't work, try $post.
 
Top Bottom