Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 02-22-2010, 07:56 PM
utahraves's Avatar
utahraves utahraves is offline
 
Join Date: May 2007
Location: Utah
Posts: 169
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Condition worked in 4.0.1, but not in 4.0.2

This was the same conditional IF command I was using on 4.0.1, upgraded and now it no longer works?
Template: Postbit
Code:
<vb:if condition="(THIS_SCRIPT == showthread) AND (($post[postcount] % 5) == 0)">
<div class="attachments" align=center>
...
</div>
</vb:if>
The code is to display a banner after every five posts only in SHOWTHREAD (postbit shows up as private messages too).

Even taking out the "THIS_SCRIPT == showthread) AND" did not resolve the issue.
Please help
Reply With Quote
  #2  
Old 02-22-2010, 09:50 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Did you try printing out the value of $post[postcount] to see what was going on? It should work. You are using the postbit template and not the postbit_legacy template, right?
Reply With Quote
  #3  
Old 02-22-2010, 11:11 PM
utahraves's Avatar
utahraves utahraves is offline
 
Join Date: May 2007
Location: Utah
Posts: 169
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Correct. I am using the postbit template and not postbit_legacy.

I typed in $post[postcount] in the postbit ---
It put 5 "$post[postcount]" underneath the first post but not under any other posts (I'd expect it to do it under EACH post, not at the end of the first post).

I replaced the $post[postcount] with {vb:raw post.postcount} and refreshed, now under the first post I see "1 2 3 4 5" --- There are 5 posts in this thread.

Edit: I have also disabled all of my modifications to see if it was a mod and I am still able to produce.
Reply With Quote
  #4  
Old 02-23-2010, 12:58 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I just put that code into my postbit template and it shows up in post 5 and 10 of my 12 post thread. Are you sure it isn't in the page source at all?
Reply With Quote
  #5  
Old 02-23-2010, 04:55 PM
utahraves's Avatar
utahraves utahraves is offline
 
Join Date: May 2007
Location: Utah
Posts: 169
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well I feel like a complete idiot. I wasn't really paying attention to the code I was putting in between those fields. I was accidentally putting a counter code in the postbit instead of the banner code. I feel completely ridiculous - I have a cold from Hell and it is totally screwing with me.

Thanks Lynne - always appreciate your help.

Edit: So I put the right code in --- but the DIV attachments is spreading from post 1 to post 5 and ends with the banner, starts up again post 6 and ends with post 10... maybe I have to RE-revert my templates... *hates doing this*
Reply With Quote
  #6  
Old 02-23-2010, 08:22 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Check your code that you closed your tags correctly.
Reply With Quote
  #7  
Old 03-30-2010, 07:37 PM
cmiller1014 cmiller1014 is offline
 
Join Date: May 2004
Posts: 248
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks guys! This worked great!!
Reply With Quote
  #8  
Old 10-06-2016, 11:50 AM
Curious Too Curious Too is offline
 
Join Date: Jun 2006
Posts: 29
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I tried this code with VBulletin 4.2.3 and it only shows the ad after the 5th post. What needs to change so that it shows an ad every 5th post?

Code:
<vb:if condition="(THIS_SCRIPT == showthread) AND (($post[postcount] % 5) == 0)">
Reply With Quote
  #9  
Old 10-06-2016, 02:45 PM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Wow, 6.5 year old thread .....

As posted, that will generate at least two php warnings, it should be 'showthread' not showthread (i.e. with single quotes), postcount should also be [single] quoted.
Reply With Quote
Благодарность от:
Curious Too
  #10  
Old 10-06-2016, 04:56 PM
Curious Too Curious Too is offline
 
Join Date: Jun 2006
Posts: 29
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Paul M View Post
Wow, 6.5 year old thread .....

As posted, that will generate at least two php warnings, it should be 'showthread' not showthread (i.e. with single quotes), postcount should also be [single] quoted.
Thanks. The ad shows but does not repeat every 5 posts -- it only shows after the 5th post.

Code:
if condition="(THIS_SCRIPT == 'showthread') AND (($post['postcount'] % 5) == 0)
Is this the correct conditional for showing an ad every x number of posts?
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 10:21 AM.


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.06601 seconds
  • Memory Usage 2,260KB
  • Queries Executed 13 (?)
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
  • (3)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (1)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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_postinfo_query
  • fetch_postinfo
  • 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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete