![]() |
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)"> Even taking out the "THIS_SCRIPT == showthread) AND" did not resolve the issue. Please help :) |
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?
|
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. :( |
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?
|
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* |
Check your code that you closed your tags correctly.
|
Thanks guys! This worked great!!
|
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)"> |
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. |
Quote:
Code:
if condition="(THIS_SCRIPT == 'showthread') AND (($post['postcount'] % 5) == 0) |
Impossible to be sure without some sort of context.
What code is around it, where have you actually put this ? |
Quote:
|
I just added this code to the very end of my postbit_legacy template and it shows after post 5, 10, 15, and 20 (other than the formatting being bad):
HTML Code:
<vb:if condition="(THIS_SCRIPT == 'showthread') AND (($post['postcount'] % 5) == 0)"> |
Thank you Lynne. It works by itself but when I combine it with another conditional to only shoe the ad in specific forums it only shows the ad once:
Code:
<vb:if condition="(THIS_SCRIPT == 'showthread') AND (($post['postcount'] % 5) == 0) AND in_array($GLOBALS['forumid'], array(419,232))"> |
How about you post the full code you are using.
First you post some snippet and claim it doesnt work (when it looks fine). Lynne uses that exact same code, which works, and now suddenly it works for you ? Except you now you claim some other code doesnt work (which again, on the face of it, looks fine). We cannot help you if you dont give us all the information. |
All times are GMT. The time now is 05:49 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:
|