Back to vBulletin 3 Articles

Variable's For Beginners
by melefire 20 Jun 2006

I hope that no one already wrote this.
Copyright 2006 MeleFire, You may not move this article from vBulletin.org

Description:
When writing hacks you may somtimes use the 'vBulletin Options' system, this system allows you to easily add your own options page for your hack. It also gives you variables that look like:
Code:
$vbulletin->options[optionname]
Those variables are good for conditional statments but if in the admincp your option requires the admin to enter text(not just yes or no) and then you attempt to put that variable inside a template so the text the admin entered will come up you will get the words:
Code:
Array[optionname]
So basically that dosn't work at all.

How to Fix the Problem:
Fixing the problem is not very hard. But you will need to have complete accses to the PHP page that calls the template. If you do not have a PHP page or a template visit this article, it tells how to make a custom vBulletin PHP/Template page.

Now you must open up your PHP page and find this code:*
Code:
$navbits[$parent] =
Add under:
Code:
$myvariable = $vbulletin->options[youroptionname]
Remember to replace myvariable with whatever you want your variable to be called and to replace youroptionname with what ever your option is called.
*If you did not find the first code you may just place the second code any where after the 'START MAIN SCRIPT'.

FAQ:
Q: Where is my option name?

A: On your options page for your hack(in DEBUG mode) click edit find varname: This is your option name.
http://img210.imageshack.us/my.php?image=youroptionname5rl.jpg

Q: What version of vBulletin will this work for?

A: 3.5.0 - 3.6 Beta 2, but only 3.5.4 and 3.6 Beta 2 have been heavily tested.

----------
I hope this helped, please give me feedback!:classic:

vblts.ru supports vBulletin®, 2022-2024