Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 11-04-2009, 02:35 PM
rockon rockon is offline
 
Join Date: Jul 2009
Location: The WWW
Posts: 56
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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!
Reply With Quote
  #2  
Old 11-04-2009, 03:13 PM
LuisMontemayor LuisMontemayor is offline
 
Join Date: Oct 2009
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #3  
Old 11-04-2009, 03:26 PM
rockon rockon is offline
 
Join Date: Jul 2009
Location: The WWW
Posts: 56
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yeh that sprung to my mind but don't think it can be used for this.
Reply With Quote
  #4  
Old 11-04-2009, 05:26 PM
rockon rockon is offline
 
Join Date: Jul 2009
Location: The WWW
Posts: 56
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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!
Reply With Quote
  #5  
Old 11-05-2009, 09:48 AM
valdet's Avatar
valdet valdet is offline
 
Join Date: Feb 2007
Posts: 505
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #6  
Old 11-05-2009, 09:57 AM
rockon rockon is offline
 
Join Date: Jul 2009
Location: The WWW
Posts: 56
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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



??
Reply With Quote
  #7  
Old 11-05-2009, 03:10 PM
valdet's Avatar
valdet valdet is offline
 
Join Date: Feb 2007
Posts: 505
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #8  
Old 11-05-2009, 03:22 PM
rockon rockon is offline
 
Join Date: Jul 2009
Location: The WWW
Posts: 56
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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

Thanks for the help!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:36 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.04034 seconds
  • Memory Usage 2,231KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (6)bbcode_code
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete