The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Counters within a template?
Is there any way to put a global variable into a template (like postbit or threadbit) so that I can modify the output with conditionals once criteria is met?
For example, a simple counter count++ placed in a template so that it increases every time the template is loaded on a page, and if the count gets to a certain number I can make a change to the output with an <if>? I don't know if this can be done in a template without using a plugin or file change. Thanks! |
#2
|
||||
|
||||
Code:
<if condition="++$count == 10">We've reached 10!</if> |
#3
|
|||
|
|||
Do I need to initialize it or anything?
|
#4
|
||||
|
||||
No. As long as $count has not been used - it will be empty, or "zero". If you want to initialise it first, you can do this (bit messy though):
Code:
<if condition="!isset($count)"><if condition="$count = 0"></if></if><if condition="++$count == 10">We've reached 10!</if> |
#5
|
|||
|
|||
Can you tell me how to do an OR with that same construct? I can't seem to get it to work.
Thanks! |
#6
|
||||
|
||||
Code:
<if condition="$condition1 == true OR $condition2 == true">Either condition 1 or 2 is true.</if> |
#7
|
|||
|
|||
Do I put the ++ on one of the variables or both of them?
|
#8
|
||||
|
||||
What exactly do you want to do? "++" means increment.
|
#9
|
|||
|
|||
I know, I just didn't understand if I am using multiple conditionals if I needed to put the ++ in both conditions.
I think I have it now, thanks! |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|