The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
vb:if conditional inside a vb:each ... possible?
Is it possible to nest a <vb:if> conditional inside a <vb:each>?
Here is what I am trying to accomplish: Code:
<vb:each from="full_list" value="list"> <tr> <td>{vb:raw list['char_name']} </td> <td> {vb:raw list['class_1_name']}({vb:raw list['class_1_level']}) <vb:if condition="full_list.class_2 != 0"> , {vb:raw list['class_2_name']}({vb:raw list['class_2_level']}) </vb:if> <vb:if condition="full_list.class_3 != 0"> , {vb:raw list['class_3_desc']}({vb:raw list['class_3_level']}) </vb:if> </td> </tr> </vb:each> Code:
Char Name Class1 Name(10), Class2 Name(3) Char Name Class1 Name(5) Char Name Class1 Name(15), Class2 Name(3), Class3 Name(2) Any help would be appreciated. I've tried things like != '0', != NULL, != 'NULL', !='', etc. I've also tried various syntax for the 'full_list.class_3' part of the if conditional, no joy. --------------- Added [DATE]1298499736[/DATE] at [TIME]1298499736[/TIME] --------------- Looks like I posted prematurely again! Hopefully this will help others in the future though. SOLUTION! As you can see, i changed up the syntax in the IF conditional. I also took my previous advice and changed the database field from a DEFAULT NULL to a DEFAULT '0'. Code:
<vb:each from="full_list" value="list"> <tr> <td>{vb:raw list['char_name']} </td> <td> {vb:raw list['class_1_name']}({vb:raw list['class_1_level']}) <vb:if condition="$list['class_2_level'] != 0"> , {vb:raw list['class_2_name']}({vb:raw list['class_2_level']}) </vb:if> <vb:if condition="$list['class_3_level'] != 0"> , {vb:raw list['class_3_desc']}({vb:raw list['class_3_level']}) </vb:if> </td> </tr> </vb:each> |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|