vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   Miscellaneous Hacks - Add additional_css.css to all your pages (https://vborg.vbsupport.ru/showthread.php?t=228628)

fxdigi-cash 07-08-2013 04:24 AM

Quote:

Originally Posted by Lynne (Post 2432658)
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...!!

tbworld 07-08-2013 05:51 AM

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.

tbworld 07-08-2013 06:09 AM

Quote:

Originally Posted by fxdigi-cash (Post 2432677)
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.

fxdigi-cash 07-08-2013 06:21 AM

Quote:

Originally Posted by tbworld (Post 2432680)
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,

tbworld 07-08-2013 06:23 AM

Quote:

Originally Posted by fxdigi-cash (Post 2432676)
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.

fxdigi-cash 07-08-2013 06:24 AM

Quote:

Originally Posted by tbworld (Post 2432681)
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.

fxdigi-cash 07-08-2013 06:39 AM

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

Thanks a lot.

tbworld 07-08-2013 07:03 AM

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.

fxdigi-cash 07-08-2013 07:26 AM

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??

tbworld 07-08-2013 07:36 AM

Quote:

Originally Posted by fxdigi-cash (Post 2432685)
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.


All times are GMT. The time now is 12:54 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01176 seconds
  • Memory Usage 1,765KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (6)bbcode_code_printable
  • (3)bbcode_php_printable
  • (6)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete