Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > vBulletin 4 Articles
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
[vb4] Adding a stylevar
Carnage
Join Date: Jan 2005
Posts: 760

 

uk
Show Printable Version Email this Page Subscription
Carnage Carnage is offline 01-22-2010, 10:00 PM

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.
Reply With Quote
  #2  
Old 01-24-2010, 11:44 PM
cbiweb cbiweb is offline
 
Join Date: May 2004
Location: Nova Scotia, Canada
Posts: 238
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Forgive my brain fart but how do I make it work after it's set up? How does vBulletin know what to do with it?
Reply With Quote
  #3  
Old 01-25-2010, 10:24 AM
Carnage Carnage is offline
 
Join Date: Jan 2005
Location: uk
Posts: 760
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

There are various types of style var; off the top of my head there are thigns like colour, border and background. Depending on the type you pick depenends on how vb handles it.

You use it just like you would any other style var.
Reply With Quote
  #4  
Old 01-25-2010, 05:36 PM
3DUInc's Avatar
3DUInc 3DUInc is offline
 
Join Date: Jan 2010
Location: Seattle
Posts: 45
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is really excellent and I will use this after the final updater. I bet vb will be adding many more stylevers because some are turned off and some are still needed. Excellent job

I think what cbiweb is referring to is how does the stylever know what it is assigned to change, like if you wanted a border around the body, how would the created stylever know that is what it is assigned to do? Im kinda wonderin this myself but I have not tried this so it may be self explaniory when you install it.

Again, excellent job
Reply With Quote
  #5  
Old 01-25-2010, 07:47 PM
Carnage Carnage is offline
 
Join Date: Jan 2005
Location: uk
Posts: 760
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You basically need to put the style var into your own template.

As an example; my [pbpg] chess mod defines two style vars, one for the background of a black square, one for the background of a white square.

I then added these two style vars to a style sheet within one of the templates like so:

Code:
<style>
.whitesquare {
background: {vb:stylevar whitebackground}
}
</style>
Reply With Quote
  #6  
Old 01-26-2010, 02:12 AM
3DUInc's Avatar
3DUInc 3DUInc is offline
 
Join Date: Jan 2010
Location: Seattle
Posts: 45
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ah-ha OK very cool and thank you. I understand fully now
Reply With Quote
  #7  
Old 02-09-2010, 11:04 AM
yaghoub's Avatar
yaghoub yaghoub is offline
 
Join Date: Oct 2008
Posts: 61
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Group
StyleVar ID
Friendly Name
comments
whats fill this value
Reply With Quote
  #8  
Old 02-09-2010, 01:23 PM
Carnage Carnage is offline
 
Join Date: Jan 2005
Location: uk
Posts: 760
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Group: this is used for where the style var is displayed in the style var editor; the bold titles are the groups. If you enter an unused title, a new group should be automatically created.

Stylevarid: this is the name for your style var and the name you use to refer to it in template. Must be unique

Friendly name: no effect at the moment, but it will at some point be used as the name the style var is called in the stylevar editor.

Description: not exactly sure where this is displayed but it should describe the style var

Other fields should be obvious.
Reply With Quote
  #9  
Old 02-11-2010, 09:52 AM
yaghoub's Avatar
yaghoub yaghoub is offline
 
Join Date: Oct 2008
Posts: 61
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks
Reply With Quote
  #10  
Old 02-11-2010, 02:12 PM
cbiweb cbiweb is offline
 
Join Date: May 2004
Location: Nova Scotia, Canada
Posts: 238
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by yaghoub View Post
Group
StyleVar ID
Friendly Name
comments
whats fill this value
See the attached screenshot for a visual explanation.
Attached Images
File Type: png stylevarParts.png (60.6 KB, 0 views)
Reply With Quote
Reply


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 06:47 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
  • Page Generation 0.08270 seconds
  • Memory Usage 2,318KB
  • Queries Executed 26 (?)
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
  • (1)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
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (1)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (1)postbit_attachment
  • (10)postbit_onlinestatus
  • (10)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_display_complete
  • post_thanks_function_can_thank_this_post_start
  • postbit_attachment
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete