Back to vBulletin 4 Articles

[vb4] Adding a stylevar
by Carnage 23 Jan 2010

I had no idea that most people had no clue how to do this or that it was even possible so here goes.

Step 1.
Put your board into debug mode by adding this

PHP Code:
$config['Misc']['debug'] = true
to config.php

Step 2.
Goto the style manager, you will now see an additional style 'MASTER STYLE'

Step 3.
Enter the stylevar editor for MASTER STYLE

Step 4.
In addition to the regular stylevar editor, you will have two buttons to add and delete stylevars. Click add stylevar

Step 5.
Fill in the form to add the style var. If you select a product you are working from from the dropdown, it'll be included in the product xml file when you export. Its always a good idea to prefix your variables so they don't conflict with other peoples. The product id makes a good prefix.

Step 6.
Setting the value for it in the master style, sets its default value.

Step 7.
You can use this stylevar in your templates with the following code:

Code:
{vb:stylevar <stylevar name>}
You can also customise it as normal in any of your custom styles.

Step 8.
Remove or comment out the line you added in step 1 to take your board out of debug mode.

vblts.ru supports vBulletin®, 2022-2024