Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Add additional_css.css to all your pages Details »»
Add additional_css.css to all your pages
Version: 1.00, by Lynne Lynne is offline
Developer Last Online: Oct 2022 Show Printable Version Email this Page

Category: Miscellaneous Hacks - Version: 4.0.0 Rating:
Released: 11-21-2009 Last Update: 12-07-2009 Installs: 173
Uses Plugins Auto-Templates
Re-useable Code Translations  
No support by the author.

Instead of finding the template.css file to edit the .css properties for your pages, just put them all in this additional_css.css template. The additional_css.css file is linked right before the </head> in your page. This is for use until this is made standard in the vb product (I put in a bug report requesting this be included - Please consider adding user defined Additional CSS to pages).


Version History:
1.0 2009-11-22: - initial release by Lynne at vbulletin.org
1.1 2009-12-08: - fixed issue with style dateline not showing up. Fixed & issue (changes to &amp. added additional2_css.css file so the first additional_css file can be used in the parent style and then additional2_css used in the child styles.

Notes - if you only want this included on certain pages, then you may open the plugin "Add addition_css.css file to pages" and put a condition around it, such as (this is for just the index page and the showthread page):
PHP Code:
if (in_array(THIS_SCRIPT,array('index','showthread'))) {
all the code currently in the plugin

.
.
To install:

1. Import product-product-lynne_add_css.xml
2. Add any additional css you want to add to the page in your additional_css.css template.

To uninstall:

1. Uninstall "Add additional css to your style"

Please mark Installed if you use this.

Download Now

File Type: zip Add Additional CSS.zip (3.0 KB, 219 views)
File Type: zip Add Additional CSS 1.1.zip (2.8 KB, 717 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Благодарность от:
Toorak Times

Comments
  #92  
Old 07-08-2013, 04:24 AM
fxdigi-cash fxdigi-cash is offline
 
Join Date: Jul 2012
Posts: 674
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
As tbworld explained, this mod is really not needed anymore as there has now been an additional.css template added to the software which is called on every page.
ok, that's what tbworld said.... now how is the additional.css file is served?? and where to play with it since I don't see any place for it to switch it on or off ??

explain more please,

Thanks

Update: do you mean this code:
PHP Code:
{vb:cssfile additional.css
but still this one comes from database and I want it to be either in the vb root or outside the vb root if possible...!!
Reply With Quote
  #93  
Old 07-08-2013, 05:51 AM
tbworld tbworld is offline
 
Join Date: Oct 2008
Posts: 2,126
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have not tested it and I wrote the code pretty verbose so you get the concept. When I get a chance I will rewrite it. I am trying to help quite a few people right now so excuse my brevity.

By your request this is suppose to store a unique "additionalcss(id).css to your main bbs url. Different styles can require different additionalcss files. if you do not need that then all you really need to do is append a new file to the bottom of your <head>
code.

Code:
// Header Hook: parse_templates

    $nw_cssbegin     = '<link rel="stylesheet" type="text/css" href="';    
    $nw_cssend       = '" ' . '/>';

    // additionalcss_00011.css  =  styleid 11        
    $nw_cssfile       = 'additionalcss_' . str_pad($style['styleid'], 5, '0', STR_PAD_LEFT) . '.css';
    $nw_csspath     = $vbulletin->options['bburl'] . '/';
    $nw_cssout      = $nw_cssbegin . $nw_csspath . $nw_cssfile . $nw_cssend;

    $template_hook['headinclude_bottom_css'] .= $nw_cssout;
Again... its just to view the concept, there is no reason to use all those variables. There is nothing unique about this plugin code.
Reply With Quote
  #94  
Old 07-08-2013, 06:09 AM
tbworld tbworld is offline
 
Join Date: Oct 2008
Posts: 2,126
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by fxdigi-cash View Post
Update: do you mean this code:

PHP Code:
{vb:cssfile additional.css
I believe that code will load the css either from the database or css-stored-as-files: Depending what admincp options are set to.
Reply With Quote
  #95  
Old 07-08-2013, 06:21 AM
fxdigi-cash fxdigi-cash is offline
 
Join Date: Jul 2012
Posts: 674
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by tbworld View Post
I have not tested it and I wrote the code pretty verbose so you get the concept. When I get a chance I will rewrite it. I am trying to help quite a few people right now so excuse my brevity.

By your request this is suppose to store a unique "additionalcss(id).css to your main bbs url. Different styles can require different additionalcss files. if you do not need that then all you really need to do is append a new file to the bottom of your <head>
code.

Code:
// Header Hook: parse_templates

    $nw_cssbegin     = '<link rel="stylesheet" type="text/css" href="';    
    $nw_cssend       = '" ' . '/>';

    // additionalcss_00011.css  =  styleid 11        
    $nw_cssfile       = 'additionalcss_' . str_pad($style['styleid'], 5, '0', STR_PAD_LEFT) . '.css';
    $nw_csspath     = $vbulletin->options['bburl'] . '/';
    $nw_cssout      = $nw_cssbegin . $nw_csspath . $nw_cssfile . $nw_cssend;

    $template_hook['headinclude_bottom_css'] .= $nw_cssout;
Again... its just to view the concept, there is no reason to use all those variables. There is nothing unique about this plugin code.
Thanks for the code,

I used it as new plugin using parse_templates, but didn't work... possibly there is something missing!!!

I did it like this:

PHP Code:
// Header Hook: parse_templates

    
$nw_cssbegin     '<link rel="stylesheet" type="text/css" href="http://stat.mydomain.com/style.css';    
    
$nw_cssend       '" ' '/>';

    
// additionalcss_00011.css  =  styleid 11        
    
$nw_cssfile       'additionalcss_' str_pad($style['styleid'], 5'0'STR_PAD_LEFT) . '.css';
    
$nw_csspath     $vbulletin->options['bburl'] . '/';
    
$nw_cssout      $nw_cssbegin $nw_csspath $nw_cssfile $nw_cssend;

    
$template_hook['headinclude_bottom_css'] .= $nw_cssout
The style I use is id=5 and I don't know what else I have to do...

I changed
Code:
$template_hook['headinclude_bottom_css']
to
Code:
$template_hook['headinclude_css']
for testing purposes, but nothing worked so far.

also, the whole external link on page html doesn't show...

any idea??

Thanks,
Reply With Quote
  #96  
Old 07-08-2013, 06:23 AM
tbworld tbworld is offline
 
Join Date: Oct 2008
Posts: 2,126
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by fxdigi-cash View Post
I decided then to take a copy of additional.css template and make a file outside the vb board and send it to the headinclude, but still not working. The code works fine, but vb doesn't take it in consideration...
I have not tried any of this actually for additional.css. The way it works in vb has been working just fine for me.

I will spend a bit of time and see if you are right about it "additional.css" pulling from the database. Hey, anything is possible. Bugs can creep back in...

I have used similar code to overwrite members.css giving each user an extended control panel over their user area, because we have 30,000 users we use our own caching file system to handle this. Because of the amount of data storing this in the database was not feasible.
Reply With Quote
  #97  
Old 07-08-2013, 06:24 AM
fxdigi-cash fxdigi-cash is offline
 
Join Date: Jul 2012
Posts: 674
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by tbworld View Post
I believe that code will load the css either from the database or css-stored-as-files: Depending what admincp options are set to.
yes, you are right. however, even I change the option from storing to css files or to database, it is always showing the link from the database using css.php ....

something is not correct here.
Reply With Quote
  #98  
Old 07-08-2013, 06:39 AM
fxdigi-cash fxdigi-cash is offline
 
Join Date: Jul 2012
Posts: 674
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ok, look like I have no other way than waiting your code . I will keep trying anyways.

Thanks a lot.
Reply With Quote
  #99  
Old 07-08-2013, 07:03 AM
tbworld tbworld is offline
 
Join Date: Oct 2008
Posts: 2,126
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Okay the code worked as it was. But I added a filename base so that it was easier to understand.

Code:
// Header Hook : parse_templates
    global $vbulletin;

    $nw_cssfilebase    = 'additionalcss_';
    $nw_cssbegin     = '<link rel="stylesheet" type="text/css" href="';    
    $nw_cssend         = '" ' . '/>';

    // additionalcss_00011.css  =  styleid 11        
    $nw_cssfile        = $nw_cssfilebase . str_pad($style['styleid'], 5, '0', STR_PAD_LEFT) . '.css';
    $nw_csspath     = $vbulletin->options['bburl'] . '/';
    $nw_cssout         = $nw_cssbegin . $nw_csspath . $nw_cssfile . $nw_cssend;

    $template_hook['headinclude_bottom_css'] .= $nw_cssout;
    unset($nw_csspath, $nw_cssout, $nw_cssend, $nw_cssbegin, $nw_cssfile, $nw_cssfilebase);
Create a file call it "additionalcss_00005.css" store it at your forum url.

additionalcss_00005.css
Code:
body {
 background: red !important;
}
.body_wrapper {
    background: blue !important;
}
Should turn the wallpaper to RED.


This code is a learning example it is very verbose, you do want to rewrite it for a production environment.
Reply With Quote
Благодарность от:
fxdigi-cash
  #100  
Old 07-08-2013, 07:26 AM
fxdigi-cash fxdigi-cash is offline
 
Join Date: Jul 2012
Posts: 674
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks,

I will try it out and see how things go.



by the way, can I place my .css file inside vb folders ?? how about outside vb forum root??
Reply With Quote
  #101  
Old 07-08-2013, 07:36 AM
tbworld tbworld is offline
 
Join Date: Oct 2008
Posts: 2,126
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by fxdigi-cash View Post
yes, you are right. however, even I change the option from storing to css files or to database, it is always showing the link from the database using css.php ....
something is not correct here.
On my develop station I am running vb4.20 and I checked the operation of storing css as files and "additional.css" and it is pulling from the correct style directories and not the database.

I am not sure what link you are refering to using css.php. Pass me a link to your board and I can check it out.
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 08: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.04678 seconds
  • Memory Usage 2,362KB
  • 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
  • (6)bbcode_code
  • (4)bbcode_php
  • (6)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (2)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (2)postbit_attachment
  • (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_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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete