The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Cant get IF statement to work.
Can't get this to work, any ideas on how to fix it?
Code:
Code removed :P |
#2
|
|||
|
|||
Try this:
Code:
<vb:if condition="is_member_of($bbuserinfo, 6)"> <vb:if condition="$bbuserinfo['field5'] == 'Grey'"><img src="/images/ranks/grey.png"></vb:if> <vb:if condition="$bbuserinfo['field5'] == 'Red'"><img src="/images/ranks/red.png"></vb:if> <vb:if condition="$bbuserinfo['field5'] == 'Blue'"><img src="/images/ranks/blue.png"></vb:if> <vb:if condition="$bbuserinfo['field5'] == 'Green'"><img src="/images/ranks/green.png"></vb:if> </vb:if> |
#3
|
|||
|
|||
Quote:
Code:
The following error occurred when attempting to evaluate this template: %1$s This is likely caused by a malformed conditional statement. It is highly recommended that you fix this error before continuing, but you may continue as-is if you wish. Is there any way to do this through a Plugin? I'm really new to conditionals and PHP. |
#4
|
|||
|
|||
Sorry, there were a few other problems. I fixed my post above.
If you'd rather do it in a plugin, you could figure out which file name you want to use and register it to the template. Then you would just need to use a template variable in the img src="", like Plugin: Code:
$file = '/images/ranks/' . $bbuserinfo['field5']; vB_Template::preRegister('template_name', array('userbar_color' => $file)); Template: Code:
<vb:if condition="is_member_of($bbuserinfo, 6)"> <img src="{vb:raw userbar_color}"> </vb:if> But there's really no difference either way. |
#5
|
|||
|
|||
Quote:
|
#6
|
||||
|
||||
If I'm right he can even do something like this
Code:
<vb:if condition="is_member_of($bbuserinfo, 6)"> <img src="/images/ranks/{bbuserinfo.field5}.png"> </vb:if> |
#7
|
|||
|
|||
Yeah, I don't know why I decided to do that in the plugin example but not suggest doing it in the template. I guess I didn't want to deal with the upper/lower case issue, then forgot about it.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|