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)

synth19 10-04-2010 07:33 PM

^ cool. I didnt get back on Vb.com for your response, thanks for the tip. However, when i go unter the main CSS, it says "This CSS file is obsolete and is available here for reference purposes only."

gosiah23 10-11-2010 07:29 PM

1 Attachment(s)
Lynne, I would love to make changes to my images like increase the text padding around images. Please see attached images.

I'm assuming that I can use this plugin to do that? Could you be so kind and give an example of a code how to do that. I'm not good in modifying php.

Attachment 122742

Attachment 122743

Thanks a million!

Margaret

Lynne 10-11-2010 07:50 PM

Just add something like:
HTML Code:

.postbit  .content img, .postbitlegacy .content img, .postbitdeleted .content  img, .postbitignored .content img, .eventbit .content img {
padding:0 10px;
}

(Don't have to include all five if you don't want it for all five.)

gosiah23 10-11-2010 08:01 PM

That worked perfectly! I cannot thank you enough! :)

Blessings to you!

Margaret

markbu 09-22-2011 02:45 PM

thanks!
if I store css as files what should I change the css path to?

ejup2009 03-06-2012 11:27 AM

gracias

excelente aplicaciòn.. pienso usarla en otro sistema pero de verdad que es muy practica...

fxdigi-cash 07-07-2013 05:55 PM

Thanks Lynne for this mod.

I believe there is an issue shows up when activating store css as file...

is there a way how to import the additional file to every page from the vb root instead of the database??

Thanks

tbworld 07-07-2013 09:30 PM

Additional_css.css -Lynne's mod is now part of vbulletin4.

There are some small oddities, but for the most part store css as files works fine for most people.

You can just add another css link in your headinclude template to an external CSS file. If you want an example let me know.

Lynne 07-08-2013 02:26 AM

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.

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

Quote:

Originally Posted by tbworld (Post 2432628)
Additional_css.css -Lynne's mod is now part of vbulletin4.

There are some small oddities, but for the most part store css as files works fine for most people.

You can just add another css link in your headinclude template to an external CSS file. If you want an example let me know.

ok great to know that. However, I still have some issue sending additional.css from the database not from direct css files. I switched the store css as files property on and then I noticed that additional.css is still being served from the database!!!

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 used this property to link the external css file:

PHP Code:

<link rel="stylesheet" type="text/css" href="mydomain.com/mystyle.css"

And by the way, I use a plugin to send the additional.css file to vb, but you said that this became a part of vb built-in function!!! how and where to switch it on???

please explain a little more.

Thanks

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.

tbworld 07-08-2013 09:41 AM

Quote:

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

Change the php code to whatever path you want, but the client's browser must be able to access the file. IE8 and below may squawk on some rewriting of the url.

I was showing you a method, I don't really understand why you need to do any of this? If I understood your need here better I might be able to point you to another method or discourage you from going down a path that is not needed. Like I said before, there is nothing unique or gifted about this code.

fxdigi-cash 07-08-2013 03:23 PM

Quote:

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

here you are:

Forex Mega Cash Back

it is not open now, but still can see the code in the browser :)

Thanks


All times are GMT. The time now is 03:01 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.01355 seconds
  • Memory Usage 1,814KB
  • 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
  • (1)bbcode_html_printable
  • (4)bbcode_php_printable
  • (9)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (22)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