• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

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


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?

Chris D

XenForo developer
Staff member
Posts per page is a global option and the values of global options are available... globally :p

In a template, you can do:


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

{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.