-
Switch case
Hi,
I'm trying to make a template with a conditional argument (if-else if- else)
I see that the switch function might do it but I can't find a way to make it work (or if it exists).
I found a template that could work: https://www.vaultwiki.org/pages/Temp...mplate:testext
Then, I tried to mimic the template so it's something like this
Code:
[if={{{Tagname}}}==Mod]1[TABLE]|- | style="width: 150px; background-color:#6799C1; color:#FFFFFF; text-align: center" | Moderator [/TABLE]
[else /][if={{{Tagname}}}==Wiki]2[TABLE]|- | style="width: 150px; background-color:#038303; color:#FFFFFF; text-align: center" | Wiki Team [/TABLE]
[else /]3Test
[/if][/if]
What I get is 1, 2 or 3Test
I do not see the tables. My conditions are working since I see 1 and 2 when I call the template. Is there a better way or a way to make the table appear when I enter the condition?
-
Those TABLEs are VaultWiki format (but are missing line breaks, which I believe are needed).
However, if you are using vBulletin 4.1.4 or later or XenForo 2 or later, and if you installed VaultWiki after your forum was already that version, then your forum's TABLE is a different format (the one bundled with your forum). If you want to use VaultWiki's TABLE BB-Code, you will have to find it in your AdminCP's Custom BB-Code list, as it may have a different name (which you may want to change), and it may not be enabled by default.
From what I read about the proposal, a switch function does not exist. It was determined that it doesn't actually make the code any easier to read later.
-
Right, with a little play, I was able to make it work
Code:
[if={{{Tagname}}}==Mod]
[TABLE]
|-
| style="width: 150px; background-color:#6799C1; color:#FFFFFF; text-align: center" | Moderator
[/TABLE]
[else /][if={{{Tagname}}}==Wiki]
[TABLE]
|-
| style="width: 150px; background-color:#038303; color:#FFFFFF; text-align: center" | Wiki Team
[/TABLE]
[else /]Unknown Tag
[/if][/if]