Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > vBulletin 4 Articles

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
  #12  
Old 02-11-2010, 09:30 PM
BSMedia BSMedia is offline
 
Join Date: Feb 2009
Posts: 454
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

is there a way to add a group?

If we export a skin, does the additional stylevars go with it?
Reply With Quote
  #13  
Old 02-11-2010, 09:58 PM
cbiweb cbiweb is offline
 
Join Date: May 2004
Location: Nova Scotia, Canada
Posts: 238
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes, if you enter a name in the Group field that doesn't already exist, it will create a new group with that name automatically.

As for your second question, I would think the additional stylevars will export just fine, since they would be part of the system once you add them.
Reply With Quote
  #14  
Old 02-12-2010, 11:17 AM
Carnage Carnage is offline
 
Join Date: Jan 2005
Location: uk
Posts: 760
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

They deffinatly export with products; the values will export with styles. I'm not sure what will happen if you import a style that has stylevars in it that the board you are importing to doesn't have.

My guess is that it would create them, if not you may have to export and import them using a product files in addition to the style file.
Reply With Quote
  #15  
Old 03-15-2010, 06:47 PM
testbot testbot is offline
 
Join Date: Feb 2009
Posts: 373
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

is there away to append a style to another style using a plugin?

something like:

Code:
$vbulletin->templatecache['postbit_attachment'] .= $vbulletin->templatecache['my_template'];
Reply With Quote
  #16  
Old 10-11-2010, 09:12 PM
8thos's Avatar
8thos 8thos is offline
 
Join Date: Aug 2010
Location: Pensacola, FL
Posts: 772
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I turned my vbulletin forums off and went into debug mode.

I opened up another browser and visited my site.

The debug menu was still at the bottom. How do I prevent that from happening?
Reply With Quote
  #17  
Old 10-13-2010, 11:12 AM
Carnage Carnage is offline
 
Join Date: Jan 2005
Location: uk
Posts: 760
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

turn debug mode off again.
Reply With Quote
  #18  
Old 02-04-2011, 11:48 AM
BBF BBF is offline
 
Join Date: Dec 2006
Location: Israel, Netanya.
Posts: 97
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

there is any way to change stylevar value from the plugin system?
something like
$stylevar['MyVar'] = 2;
Reply With Quote
  #19  
Old 04-15-2011, 07:20 AM
DHS2's Avatar
DHS2 DHS2 is offline
 
Join Date: Nov 2010
Location: Switzerland
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Many Thanks!!
Reply With Quote
  #20  
Old 05-15-2011, 08:15 PM
naba naba is offline
 
Join Date: Apr 2011
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

v.good
Thanks
Reply With Quote
  #21  
Old 05-24-2011, 10:30 AM
Mukashi's Avatar
Mukashi Mukashi is offline
 
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have a stylevar which I tried to add through this method which for some reason failed and doesn't show up on the list of stylevars. Trying to add it again however tells me that a stylevar with that name already exists. How would I remove this phantom stylevar so I could put it in properly?
Reply With Quote
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 07:08 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.06097 seconds
  • Memory Usage 2,311KB
  • Queries Executed 28 (?)
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)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
  • (11)post_thanks_box
  • (1)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete