The Arcive of vBulletin Modifications Site. |
|
|
Perform simple calculations inside templates!
I was quite excited to find this out! Have you ever wanted to make a simple calculation for a template, like an addition or subtraction? Personally, I needed this many times and most of them I created a plugin for that. Today I discovered that that is unecessary. You can use the conditional to make simple calculations. For instance, lets suppose you want to display somewhere the userid of the current user, incremented by one. You could do this: HTML Code:
<if condition="$nextid = $bbuserinfo['userid']+1"></if> The next userid is $nextid. Quote:
Let me know if it helped you!
|
|
#2
|
||||
|
||||
|
interesting, thanks!
|
|
#3
|
||||
|
||||
|
Very cool! Thanks, Michelle!
|
|
#4
|
|||
|
|||
|
Is there a way we can use this to generate a random number and then test against it so that something happens only 1/X times?
|
|
#5
|
|||
|
|||
|
Nope. The functions for random number generation aren't allowed in templates, so you have to use a plugin.
|
|
#6
|
|||
|
|||
|
Thank you, Michelle.
|
|
#7
|
|||
|
|||
|
Could I change the numbers by myself ????????
for examble, the number 41, to put the number 88 or number 14 ???? ![]() |
|
#8
|
|||
|
|||
|
Quote:
|
|
#9
|
|||
|
|||
|
How could i do it ??????
|
|
#10
|
|||
|
|||
|
Anyone know what kinds of simple calculations can be done using this method?
|
![]() |
|
|