[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:
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:
|
:confused:
Looks basic but understanding for me is slow :cross-eyed: |
What don't you understand?
|
I understand it all except the part where you find and identify which conditions can be used and where/when/etc.
|
[QUOTE=Ziki;1144546]This has to start with an if condition and end with an else.elseifs belong between those two./QUOTE]
No it doesn't. You can end with just an if or elseif. You only need to start with an if. |
Well yeah that's what iI said.
|
He just means you shouldn't put an elseif after an else. That would result in an 'UNEXPECTED ...' error.
|
Yes that's what I said!
|
So would this work?
Code:
if ($vbulletin->options['show_motm'] == '1') Then, how do I install it? I am trying to make a Member of the Month code for my board and all this is confusing for a newbie to XML/Programming stuff for vBulletin Options. |
Yes but that is php code that is inserted into plugins
|
Ah ok, thanks for the info.
|
Updated
|
Sorry, but how do we get the options to show up in the vB Options area of the AdminCP?
Thanks! --------------- Added [DATE]1245270274[/DATE] at [TIME]1245270274[/TIME] --------------- Quote:
Just use phpMyAdmin to create a new option in the settings table. Then, following the format in vBphrases, setting_name_of_your_db_option_title and setting_name_of_your_db_option_desc, create your phrases and you are done Very nice :cool: |
Isn't it supposed to be:
Code:
<if condition=" "> |
No, that's not an else if just another condition inside else.
|
How do you define a "conditional" ?
|
The code wrapped inside is only run if the conditions are true.
|
ok, this might be stupid but where's the "vBulletin option admincp"
|
Enable debug mode and open vBulletin options :)
|
All times are GMT. The time now is 12:58 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|