The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
having some problems with an if condition + forumula
I've got a formula to work out a percentage from user fields, which is the postbit_display_start hook the formula looks like this:
Code:
$percentage = (intval($post['field7']) / intval($post['field6'])) * 100; So what I'm trying to do is add an if conditional to just display 0 if field 6 is 0 Here's what I've got Code:
$percentage = <if condition = "(post['field6']))=0">0 </if> <else />(intval($post['field7']) / intval($post['field6'])) * 100; |
#2
|
|||
|
|||
That is template if condition, it doesn't work in php.
PHP Code:
|
#3
|
|||
|
|||
Thanks MoT3rror, but where would I put this? If it's where I want the percentage displayed I wouldn't need the $percentage, would I?
Right now I have the formula a plugin in the hook and then just type $percentage where I want the percentage displayed. |
#4
|
|||
|
|||
You would find a hook that is where you need this code and before the template is called. Then you can put $percentage in your template.
|
#5
|
|||
|
|||
I love you! It works great! 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:
|