View Full Version : If no thread reply, then show custom message
rockon
11-04-2009, 02:35 PM
Hey guys,
I'd like to have a custom message shown below the first post of a showthread page if no one has replied to the thread yet.
I believe it would be something like this in English:
If there's a #2 post then show it and all others following.
Else, show a message saying "No one has repleid yet - be the first!"
Though, I don't have a clue and wouldn;t know how to do this. I believe it would be in the showthread template?
Any one know how to do this?
Thanks!
LuisMontemayor
11-04-2009, 03:13 PM
I don't know if this might help:
<if condition="$post[postcount] == 1">
<else />
</if>
That conditional will work only with the first post, but won't know if there are any more posts. Wish I could help you better.
rockon
11-04-2009, 03:26 PM
Yeh that sprung to my mind but don't think it can be used for this.
rockon
11-04-2009, 05:26 PM
Wouldn't it need to be 2 or greater. Possibly even greater than 1.
We need an expert! :)
I'm not even sure where the if statement should sit if we conjure something up.
Can't see where in the showthread, if it's meant to go there... it's past me. And I have the replies templated differently to the main thread using the "if postcount=1".
--------------- Added 1257410245 at 1257410245 ---------------
sorry to bump but has anyone with more knowledge got any idea? I'd love to have this functionality.
Thanks!
valdet
11-05-2009, 09:48 AM
OK this one is working for me so far. It was too simple as you suggested.
<if condition="in_array(THIS_SCRIPT, array(showthread)) AND $GLOBALS[threadinfo][replycount] >= 1">
Not sure if it's fully correct, but in my case if there are no replies to first post I can hide the ads of last post to show up below ads from first post.
rockon
11-05-2009, 09:57 AM
How would this be written? And would it be on the postbit_legacy template or the showthread template?
I tried:
<if condition="in_array(THIS_SCRIPT, array(showthread)) AND $GLOBALS[threadinfo][replycount] >= 1">
ALL POSTBIT REPLY CONTENT
<else />
ggg
</if>
and also
<if condition="in_array(THIS_SCRIPT, array(showthread)) AND $GLOBALS[threadinfo][replycount] >= 1">
ggg
<else />
ALL POSTBIT REPLY CONTENT
</if>
But neither worked. (probably wrong) - one of them replaced each reply with ggg and the other did nothing.
--------------- Added 1257440976 at 1257440976 ---------------
Maybe, if anyone knows how to make an if statement that says:
IF a certain threads reply count is less than 1
Show custom code
ELSE show replies
??
valdet
11-05-2009, 03:10 PM
I added that code in postbit_legacy template, just above the attachments area
<if condition="in_array(THIS_SCRIPT, array(showthread)) AND $GLOBALS[threadinfo][replycount] >= 1">
Anything goes in here
</if>
<if condition="$show['attachments']">
I hope that helps.
rockon
11-05-2009, 03:22 PM
I managed to get it working myself :)
I used this:
<if condition="in_array(THIS_SCRIPT, array(showthread)) AND $GLOBALS[threadinfo][replycount] <= 1">
<table style="margin-top: 8px;" width="100%" class="tborder">
<tr>
<td align="center">
No one has replied to this thread yet. Post a reply now.
</td>
</tr>
</table>
</if>
You can see that it doesn't show here:
http://www.rockonpublishing.co.uk/showthread.php?t=14
But it does here:
http://www.rockonpublishing.co.uk/showthread.php?t=15
:D Thanks for the help!
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.