vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   If no thread reply, then show custom message (https://vborg.vbsupport.ru/showthread.php?t=227382)

rockon 11-04-2009 02:35 PM

If no thread reply, then show custom message
 
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:

Code:

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:

PHP Code:

<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 [DATE]1257410245[/DATE] at [TIME]1257410245[/TIME] ---------------

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.

Code:

<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:

Code:


<if condition="in_array(THIS_SCRIPT, array(showthread)) AND $GLOBALS[threadinfo][replycount] >= 1">

ALL POSTBIT REPLY CONTENT

<else />

ggg

</if>

and also

Code:


<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 [DATE]1257440976[/DATE] at [TIME]1257440976[/TIME] ---------------

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


Code:

<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:

Code:

<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!


All times are GMT. The time now is 04:47 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
  • Page Generation 0.01008 seconds
  • Memory Usage 1,732KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (6)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete