View Single Post
Old 15-08-2008   #1 (permalink)
Komplex
KXDesign Admin
 
Komplex's Avatar
 
Join Date: Jul 2008
Location: Slovakia
Posts: 97
Rep Power: 5
Komplex is infamous around these parts
Send a message via MSN to Komplex
Lightbulb [vBulletin|PHP]vBulletin options and conditionals

Want to bring your new product onto a new level and use vBulletin options as well?Here we go

To create a simple on/off option just enter the vBulletin option admincp.Now insert the values for your desired option,when you get to the type sellect boolean.I won't describe the other types here.Boolean returns values true/1 if the condition was correct and false/0 if it wasn't.

So the variable for a vb option is $vbulletin->options['OPTIONNAME'] in plugins and php code and for templates use $vboptions[OPTIONNAME] (notice,no apostrophes in templates).So to make a simple condition:

PHP Code:
Unregistered users can not view codes.Please register.
If specifies the condition inside the brackets.If you use just the variable without the comparism sign (==) then it will think that you are checking if it is 1.

Oh I forgot,Yes = 1 and No = 0

Did you notice the else?That is executed if the condition is anything else than what we are checking with.But you can extend your code with another elseif

PHP Code:
Unregistered users can not view codes.Please register.

This was a very basic introduction into using PHP conditionals with vBulletin boolean (Yes/No) options .
__________________
.::{KXDesign Owner}::.
Komplex is offline   Reply With Quote