Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > vBulletin 3 Articles
Custom CSS Definitions
Andreas's Avatar
Andreas
Join Date: Jan 2004
Posts: 6,863

 

Germany
Show Printable Version Email this Page Subscription
Andreas Andreas is offline 04-10-2009, 10:00 PM

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, 31 views)
Reply With Quote
  #2  
Old 04-11-2009, 01:41 PM
Princeton's Avatar
Princeton Princeton is offline
 
Join Date: Nov 2001
Location: Vineland, NJ
Posts: 6,693
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thank you Andreas :up:
Reply With Quote
  #3  
Old 02-26-2016, 03:16 PM
Dr.CustUmz's Avatar
Dr.CustUmz Dr.CustUmz is offline
 
Join Date: Aug 2013
Location: USA
Posts: 647
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i know this is old as heck, but is there any explanation for the a:#'s and the s:#'s

say i want to add:
position:
border:
and more, is this possible?

and having no clue what the a's and s's stand for im kind of clueless.

also would i need to define multiple <template name=".cssdemoclass"... for each class I want to have options
Reply With Quote
  #4  
Old 02-26-2016, 06:25 PM
Replicant's Avatar
Replicant Replicant is offline
 
Join Date: Sep 2014
Location: Phoenix, Az. USA
Posts: 485
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dr.CustUmz View Post
i know this is old as heck, but is there any explanation for the a:#'s and the s:#'s
Simply put, this is PHP serialized data. Here is a pretty detailed explanation that will help you understand it better.

Can't answer the rest, sorry.
Reply With Quote
Благодарность от:
Dr.CustUmz
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:05 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04515 seconds
  • Memory Usage 2,246KB
  • Queries Executed 20 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_code
  • (2)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_article
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (4)post_thanks_box
  • (3)post_thanks_box_bit
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (4)post_thanks_postbit_info
  • (3)postbit
  • (1)postbit_attachment
  • (4)postbit_onlinestatus
  • (4)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete