View Full Version : if and else conditional help
mac27
02-18-2007, 04:42 AM
I have 2 scripts in one template that I want to use. One shows buttons and one shows text links. I am trying to make it so the user can choose which one they want to use in their forum. So I am trying to make it so that they can turn off the buttons and the text links will turn on. So I thought the <if> and <else /> conditional would work. Well it doesn't unless I did it wrong.
So what is the proper way to get this to work? Is there an easier way?
Thanks and I hope I explained this good enough.
harmor19
02-18-2007, 05:54 AM
You can do it this way.
Add a new profile field (Single-Selection Radio Buttons)
---------------------------------------------
Title: Buttons/Text
Description: Select Yes to use buttons. Choose No to use text.
Options:
Yes
No
---------------------------------------------
You can leave everything else the same.
In the template of the custom page add
<if condition="$bbuserinfo[fieldXX] == 'Yes'">
Button goes here
<else />
text goes here
</if>
Replace XX with the field number
mac27
02-18-2007, 05:59 AM
Thanks and I had thought about that. But I would rather have it so the admin can control what is used on their forum not the user.
I added a vboption with the yes and no radio buttons and tried it that way to but no luck. Some reason it won't work.
Thanks for the info. I am open to more ideas.
harmor19
02-18-2007, 06:06 AM
If you have enabled Debug Mode you should be able to add settings when you go to vBulletion Options. The best place to add your new option would be "General Settings".
So go to vBulletin Option --> General Settings
Varname: switch_buttons_text
Title: Switch Buttons/Text
Description: Select Yes to use buttons. Choose No to use text.
Option Code: yesno
Data Validation Type: Boolean
In your template add
<if condition="$vboptions[switch_buttons_text]">
Button goes here
<else />
text goes here
</if>
mac27
02-18-2007, 06:07 AM
OK I got it. Your post got me back in line again. Guess I am to tired to be working tonight. LOL
<if condition="$vboptions[varname] == '1'">
Button goes here
<else />
text goes here
</if>
That is what I had to use.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.