The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Choose 1 of 3 alternatives
I have 3 bits of code, but I only want to run one at any one time. So, I figured I could do something like this:
Code:
choice=2 If choice=1 then <run this code> Else If choice=2 then <run this code> Else If choice=3 then <run this code> End If I can do this in visual basic but not sure how to do it in a vbulletin template. Any help from someone here? I know I would have to login and edit the template each time I wanted to alter which bit of code ran. Is there any easier way that could avoid this time sapping login and search for template? Thanks, Jon |
#2
|
|||
|
|||
In vb templates you can do this:
Code:
<if condition="$choice == 1"> Choice 1 <else /><if condition="$choice == 2"> Choice 2 <else /><if condition="$choice == 3"> Choice 3 </if></if></if> But what you can't really do is assign a value to $choice. Well, OK, you can but it's cheating. If you do this: Code:
<if condition="$choice = 2"></if> It has no effect on the template output but has a side effect of assigning the value. As far as getting around the logging in an searching - maybe the easiest thing to do would be to create an admincp option for it. If you put your forum in debug mode (if you're not familiar with that, this article might be useful: www.vbulletin.org/forum/showthread.php?t=265999), then some links will appear on the admincp options pages that let you add new option groups and options (the link actually says "Add Setting"). If you create a new option with varname "my_choice" for example, then your template code can check the value by using $vboptions['my_choice']. |
#3
|
|||
|
|||
Thank you for that rather excellent reply. I am hopeful this might provide the solution I seek. I test different ad networks and often have to switch between them. Its a pain having to keep adding and deleting <!-- ---> all the time.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|