![]() |
Detecting if it is the first post in a 'showthread' page
Hi,
As the title says, I want to show something in the first post in a page (showthread) but not in the consecutive posts. Is there anyways I can detect this from within a template? I hope I am asking in the right place. Regards, Karan |
HTML Code:
<if condition="$post['postid']==$thread['firstpostid']"> |
Ah thanks for the reply :) Gonna try right away :)
Sweet! Works like a charm. Thanks sir. |
Quote:
This code is perfect for detecting if the current post is the first post even in a thread. What I was wanting to achieve is to detected (yes/no) if the current post is the first post of a thread in that page. I am sure the answer is simple, but i am not sure of where to look. Looking forward to reply. Karan |
That is more complicated. You basically need to get the variable for the postnumber (I'll call it $postnum) and the number of posts allowed on a page (there is a default, but don't forget the user can override that - I'll call this $pageposts) and then divide one by the other and if the remainder is 1 then it is the first post.
Say it is post 3, the user allows 15 posts to a page, so 3 / 15 is 0 with a remainder of 3 - so not the first post. Say it is post 46 and the user allows 15 posts to a page, so 46/15 is 3 with a remainder of 1, so it is the first post. This was actually all outlined in another thread and they may have actually come up with the code, but I don't have time to search for it. It's in the Community Discussions. Maybe search for "remainder" or something similar. |
All times are GMT. The time now is 05:54 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|