The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Need a Condition
Hello.
I need a IF-Condition to after every 4th forum (childforumbits) add HTML code. Example: - Forum 1 -- Sub-Forums -- Sub-Forums -- Sub-Forums -- Sub-Forums ADD HTML-CODE -- Sub-Forums -- Sub-Forums -- Sub-Forums -- Sub-Forums ADD HTML-CODE -- Sub-Forums -- Sub-Forums -- Sub-Forums -- Sub-Forums ADD HTML-CODE - Forum 2 -- Sub-Forums -- Sub-Forums -- Sub-Forums -- Sub-Forums ADD HTML-CODE -- Sub-Forums Thanks and best regards. PS: Maybe it will help? Code:
<vb:if condition="$GLOBALS[counter]++"></vb:if> |
#2
|
|||
|
|||
You could try this:
Code:
<vb:if condition="($GLOBALS[counter]++ % 4) == 0"></vb:if> |
Благодарность от: | ||
Forum-Germany |
#3
|
|||
|
|||
Thanks!
My Forum with your Code. Code:
<vb:if condition="($GLOBALS[counter]++ % 4) == 0">TEST</vb:if> -- Sub-Forums TEST -- Sub-Forums -- Sub-Forums TEST -- Sub-Forums -- Sub-Forums TEST -- Sub-Forums - Forum 2 -- Sub-Forums TEST -- Sub-Forums -- Sub-Forums TEST -- Sub-Forums -- Sub-Forums TEST -- Sub-Forums -- Sub-Forums TEST ... ... ... ... - Forum 3 -- Sub-Forums -- Sub-Forums TEST -- Sub-Forums -- Sub-Forums TEST -- Sub-Forums -- Sub-Forums TEST |
#4
|
|||
|
|||
So you are getting every 2nd instead of every 4th? Hmm...
|
#5
|
|||
|
|||
Yes!
If you would hide the categories, the word "TEST" in every second forum will be displayed. So yes, you're right. Can you help me? |
#6
|
|||
|
|||
I suppose that you could try changing 4 to 8. Edit: But that won't work either, because the counter needs to be reset for every parent forum.
You really should use plugins to handle the counter. Sometimes you can cheat by using ++ in a condition, but it can be complicated to get it to work right. |
#7
|
|||
|
|||
I have found a mistake. Sorry!
YES, now the word "TEST" appears in every 4th Forum. BUT ... The counter does not include the Forums Category. Now: Quote:
Quote:
|
#8
|
||||
|
||||
what template did you put that code in?
|
Благодарность от: | ||
Forum-Germany |
#9
|
|||
|
|||
Hello.
forumhome_forumbit_level2_post But does not matter. For it can not work 100% because the counter a) does not include the Forums category and b) the counter after the last sub-forum does not reset. An example: (Counter = 0) - Forum 1 -- Sub-Forums (Counter = 1) -- Sub-Forums (Counter = 2) -- Sub-Forums (Counter = 3) -- Sub-Forums (Counter = 4) ADD "TEST" -- Sub-Forums (Counter = 5) Counter Reset: (Counter = 0) - Forum 2 -- Sub-Forums (Counter = 1) -- Sub-Forums (Counter = 2) -- Sub-Forums (Counter = 3) -- Sub-Forums (Counter = 4) ADD "TEST" -- Sub-Forums (Counter = 5) -- Sub-Forums (Counter = 6) -- Sub-Forums (Counter = 7) -- Sub-Forums (Counter = 8) ADD "TEST" -- Sub-Forums (Counter = 9) Counter Reset: (Counter = 0) - Forum 3 -- Sub-Forums (Counter = 1) -- Sub-Forums (Counter = 2) -- Sub-Forums (Counter = 3) -- Sub-Forums (Counter = 4) ADD "TEST" Counter Reset: (Counter = 0) - Forum 4 -- Sub-Forums (Counter = 1) -- Sub-Forums (Counter = 2) Counter Reset: (Counter = 0) - Forum 5 -- Sub-Forums (Counter = 1) -- Sub-Forums (Counter = 2) -- Sub-Forums (Counter = 3) -- Sub-Forums (Counter = 4) ADD "TEST" -- Sub-Forums (Counter = 5) -- Sub-Forums (Counter = 6) -- Sub-Forums (Counter = 7) -- Sub-Forums (Counter = 8) ADD "TEST" |
#10
|
||||
|
||||
yea you're gonna need a plugin
|
Благодарность от: | ||
Forum-Germany |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|