![]() |
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; |
That is template if condition, it doesn't work in php.
PHP Code:
|
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. |
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.
|
I love you! It works great! Thanks =)
|
All times are GMT. The time now is 02:37 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:
|