Back to vBulletin 3 Articles

Custom CSS Definitions
by Andreas 11 Apr 2009
Rating: (1 vote - 3.00 average)

I've seen many modifications that use vBulletin settings for CSS definitions.

But there is a far better way to easily let the administrator set up CSS definitions: Create your own CSS classes!

The process is pretty straight forward:
First of all you have to create a new entry in table template:
  • templatetype = css
  • product = Your product id
  • styleid = -1
  • template
    Your serialized CSS definitions. To start with empty definitions just use
    Code:
    a:1:{s:3:"all";s:0:"";}
  • title
    Your CSS classname, for example .cssdemoclass
  • dateline
    Current UNIX timestamp
  • username
    Your username in your dev board
  • version
    The version number of your modification

I suggest to do this in phpMyAdmin, which results in a query (if you want to do it fully manually) similar to
Code:
INSERT INTO template (styleid ,title,template,templatetype,dateline,username,version,product)
VALUES (-1, '.cssdemoclass', 'a:1:{s:3:"all";s:0:"";}', 'css', 1239459129, 'Kirby', '1.0.0', 'cssdemo');
Now that you've added the new class, you should rebuild all styles.

Afterwards, you need two plugins to make the class actually editable in style manager:

css_edit
PHP Code:
print_css_row($vbphrase['css_demo_class'], $vbphrase['css_demo_class_desc'], '.cssdemoclass'1); 
css_output_build
PHP Code:
$css_write_order[] = '.cssdemoclass'
That's it, now you can edit your own class as you could edit any default class.
Attached Files
File Type: xml product-cssdemo.xml (1.9 KB, 33 views)

vblts.ru supports vBulletin®, 2022-2024