PDA

View Full Version : Miscellaneous Hacks - Add additional_css.css to all your pages


Lynne
11-21-2009, 10:00 PM
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 (http://www.vbulletin.com/forum/project.php?issueid=32262)).


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):
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 (https://vborg.vbsupport.ru/vborg_miscactions.php?do=installhack&threadid=228628) if you use this.

HMBeaty
11-22-2009, 05:32 PM
Well, definately alot easier than I just did it. haha! Thanks Lynne

Charlie98902
11-22-2009, 05:33 PM
This has unlimited potential to as I think if you make the css just right you can have it set to show usergroup html markup everywhere on your site?

bobster65
11-22-2009, 05:34 PM
brilliant Lynne! Thank you ;)

Charlie98902
11-22-2009, 05:43 PM
Tagged for gold release. :) Added to your projects reply as well :)

TimberFloorAu
11-22-2009, 06:29 PM
Excellent, also added to our Gold release products.

Ste

Fr4n-FX
11-22-2009, 07:20 PM
wow this is fantastic, i will try later. thank you!

but what happen if i have ".forum" for explame in both css files? what file have "preference" :/

Lynne
11-22-2009, 07:46 PM
wow this is fantastic, i will try later. thank you!

but what happen if i have ".forum" for explame in both css files? what file have "preference" :/
You should read up on how Cascading Style Sheets work in order to understand the answer to that question. I put this file as the very last .css file to be linked in the <head> section for a very good reason - so it is the LAST .css file to be included. If you include inline CSS or style info in the <body>, then you can 'overwrite' the styling info in this file, but this file should 'overwrite' any styling info in the previous stylesheets if it is written correctly.

TheLastSuperman
11-22-2009, 08:16 PM
Very... VERY nice Lynne - THANKS :D

Jurhum
11-22-2009, 08:45 PM
I understand we can use this to style our websites instead of using stylevars. However, when i try to change anything using this template it does not over ride the orginal css settings. Can you provide a brief example of how to change anything using this template? such as text color or anything else. thank you in advance

Lynne
11-22-2009, 09:01 PM
It is not really to be used to style instead of stylevars. It is used to add additional css without having to edit the actual .css template that has the .css in it. You may need to do a Force Refresh on your page to get the edited version of this file read after you change it.

Jurhum
11-22-2009, 10:09 PM
so we can't use this to over ride the orginal setting in a style?

Lynne
11-22-2009, 10:26 PM
Yes, you can use this to override the original settings in a style. You may use stylevars in it though, if you want. It's just another .css file, but since it is the last one, if you do your styling correctly, you may override the original style settings.

Dr.osamA
11-22-2009, 11:33 PM
try try try
________
Xxx Movies Online (http://www.++++tube.com/)

KrU$ty
11-23-2009, 06:00 AM
Thanks. A very needed mod that should be a standard in vb4.

The Wise One
11-23-2009, 09:03 AM
exactly what i was looking for. had mine in headinclude but it was getting loaded before a couple of stylesheets, making it necessary to still edit some css templates. thanks for the release. installed.

fourat
11-23-2009, 12:00 PM
Thank you Lynne
I hope adding standard additional CSS to VB 4 .. So as to become perfect and useful version
The stylevars system now imperfect

SİMAR
11-23-2009, 03:58 PM
thanks

Rene Kriest
11-30-2009, 01:44 PM
Kudos to Lynne. Good proposal. This will help designers like me alot. Thx. :)

yaghoub
11-30-2009, 02:38 PM
thanks lunne its very good for edite tempelat

alfanni
12-06-2009, 05:12 PM
Excellent. This is a missing feature in VB4.
Thanks for sharing.

anthony parsons
12-08-2009, 01:04 AM
Well Lynne, I have to say... so simple, yet so required. Not looking at the stylevars until beta5, and just today at that, and now finding how ridiculously impracticable the new stylevars system currently is, or the basic level it is at, this is an absolute requirement. Just looking into all the css files now included within the template system to achieve the layout, I discovered today how impracticable it all currently is. With coming upgrades, if I had to modify each template css, it would make future upgrades a near impossible task having to custom code each file again as no doubt the css template files will be constantly changing in revisions with a css layout. Some of the stupidity I am finding with the attempts of one stylevar and replicating it across multiple aspects of the suite... absolutely stupid IMHO.

Installed and thank you. Makes it much simplier that you have done it vs. me having to write one for my own use.

Thanks.

anthony parsons
12-08-2009, 03:20 AM
This doesn't work in beta5.... The file actually writes correctly in the acp but doesn't seem to transcend to to the frontend. All you get at the frontend is the default first two lines of text, no actual css data.

Lynne
12-08-2009, 04:10 AM
This doesn't work in beta5.... The file actually writes correctly in the acp but doesn't seem to transcend to to the frontend. All you get at the frontend is the default first two lines of text, no actual css data.
Are you entering the css into the correct style? This is still working just fine for me on both my forums only test site and my suite test site.

mtha
12-08-2009, 04:21 AM
This doesn't work in beta5.... The file actually writes correctly in the acp but doesn't seem to transcend to to the frontend. All you get at the frontend is the default first two lines of text, no actual css data.

it might be related to the combination of styleid and langid too. i have two languages, and the correct edited css only appear when langid=1, or remove langid, so i removed langid from the path where calling the css. not sure why it is yet.

anthony parsons
12-08-2009, 05:27 AM
Hey Lynne... Pretty sure. Adding css into ACP > Styles & Templates > Style Manager > Edit Templates > additional_css.css

I might try it on a clean install of beta5 I have, as I used it on an upgraded beta5 install. See if any difference exists.

anthony parsons
12-08-2009, 05:31 AM
Hmmm... just worked on clean install. My private test upgrade install though doesn't work... interesting. Ok, thanks for that. I will dig at it... as this is outside of your software.

Sarthek
12-08-2009, 11:43 AM
tagged for gold

Lynne
12-08-2009, 01:31 PM
it might be related to the combination of styleid and langid too. i have two languages, and the correct edited css only appear when langid=1, or remove langid, so i removed langid from the path where calling the css. not sure why it is yet.
This is interesting. I don't have other languages on my sites, so I haven't seen this happen. What does the url to the additional_css.css file look like in the situation where it isn't working?

I also modified this a bit for myself. I created another file additional_css2.css also. I use additional_css for css that I want in all my styles (so I 'fill' it in the parent style) and then use additional_css2 to make small changes to the child styles. Is anyone interested in that version of this?

mtha
12-08-2009, 06:19 PM
This is interesting. I don't have other languages on my sites, so I haven't seen this happen. What does the url to the additional_css.css file look like in the situation where it isn't working?

I also modified this a bit for myself. I created another file additional_css2.css also. I use additional_css for css that I want in all my styles (so I 'fill' it in the parent style) and then use additional_css2 to make small changes to the child styles. Is anyone interested in that version of this?

i dont have the forum on public accessible location, so cant give you the direct link, anyway

i have two language (1 and 2), and my styleid is 24.

when i install this, and my default language is 2, i have

/forum/css.php?styleid=24&langid=2&d=&sheet=additional_css.css

it only shows
@charset "UTF-8";
/* Additional CSS */


when i change to language 1, or set direct link to langid=1, i see the additional CSS that i added to the template.

forum/css.php?styleid=24&langid=1&d=&sheet=additional_css.css

if i remove the langid, it also show the template correctly
forum/css.php?styleid=24&d=&sheet=additional_css.css

mtha
12-08-2009, 06:38 PM
now the new version 1.1 doesnt have that problem anymore. it works great now, with langid. thanks

Lynne
12-08-2009, 06:41 PM
when i install this, and my default language is 2, i have

/forum/css.php?styleid=24&langid=2&d=&sheet=additional_css.css
And yet the other stylesheets in the page also have langid=2 and they are fine?

I can't think of why it wouldn't work. I checked my file and the template is set to templatetype="template" just like the other .css templates in the style. I really don't know anything about the language system in vbulletin since I've never used it before. If someone has any suggestions on what to look at here, I'm welcome to listen.

edit: Oh, just read your last comment that it is now working fine. Perhaps it was the missing style date that was causing the problems? Not really sure, but if it's working, then I'm glad. :)

anthony parsons
12-08-2009, 07:46 PM
It seems that a custom css is actually not needed, because you can enter custom css directly into the existing css templates, and when you upgrade between versions, the merge system takes any custom coding and merges it into the newer template being replaced with, hence why no current custom CSS solution is available within the templating / stylevars system.

Lynne
12-08-2009, 08:18 PM
Yes, you can do that, but I find it easier to have all my changes in one place instead of having to search out the template to change things there.

anthony parsons
12-09-2009, 03:37 AM
Hmmm... thanks Lynne. I asked Wayne about this also and he suggested to stick with this concept as well... being all custom css in the one place and not relying upon the merge ability of the system to get it right.

Deniz AKCANTAŞ
12-09-2009, 07:50 PM
thanks

sam12345
12-10-2009, 11:36 AM
Lynne you are genius..:up:

pneo
12-10-2009, 02:52 PM
Thank you for the fantastic (and much needed!) Mod Lynne.

Please could you clarify the syntax needed in the additional CSS please?

If for example I want to edit width of the search area that is under the '.navbar_search' selector in vbulletin.css...


.navbar_search {
position:relative;
width:180px;
bottom: 1px;
{vb:stylevar right}: -{vb:math {vb:stylevar padding}*2};
display:block;
}


Do I need to 'call' the specific css file to overwrite it in additional.css or simply place...


.navbar_search {
position:relative;
width:200px;
bottom: 1px;
{vb:stylevar right}: -{vb:math {vb:stylevar padding}*2};
display:block;
}


...and it should automatically overwrite the original (when I inspect the page after making this alteration there is no change it is only using vbulletin-chrome.css)?

This clarification may help others so I look forward to hearing your response - perhaps you could provide an example of the structure of the additional.css?

Thank you in advance.

Darkimmortal
12-10-2009, 03:00 PM
As long as you use the same or a higher priority selector (more specific) than the original then you can simply overwrite properties.

Lynne
12-10-2009, 04:31 PM
Do I need to 'call' the specific css file to overwrite it in additional.css or simply place...
.navbar_search {
position:relative;
width:200px;
bottom: 1px;
{vb:stylevar right}: -{vb:math {vb:stylevar padding}*2};
display:block;
}


...and it should automatically overwrite the original (when I inspect the page after making this alteration there is no change it is only using vbulletin-chrome.css)?

You do not need to 'call' the file, just place the css in the template. In this particular case, since all you want to do is override the width property and leave the others alone, just add this to the .css template:
.navbar_search {
width:200px;
}

wacnstac
12-11-2009, 02:00 AM
Can you use this as an alternative to editing variables in StyleVars in the Style Variable Editor which sucks because you can't see what you edited and I don't know of any way to save it.

Lynne
12-11-2009, 03:46 AM
You can use it for whatever you want. It's just for adding css. If you want to hard code a color in there for something, then you can use thing to do that.

fourat
12-24-2009, 08:29 PM
How i use this product ?

Charlie98902
12-26-2009, 06:55 PM
Thanks Lynne used this mod to change my header instead of table codes. :)

Charlie98902
12-26-2009, 06:57 PM
How i use this product ?

You have to call up the template that you want the CSS code to modify. Like I used this for my header and used #header so it would replace the defualt vbulleting header as I have 3 parts to my header. So you need to know CSS or get someone to help you or give you the CSS code needed.

Alien
12-28-2009, 03:02 AM
For the life of me, I cannot get this to work in any child styles whatsoever.

I'm using 1.1 (which still shows as 1.0 in the product manager, btw).

I've tried using just additional css with all new code, and i've also tried using the additional css 2 template leaving the original alone and I cannot get it to load the alternate color scheme. :( It always shows the parent scheme.

In the source, it links to the proper style id #

Any thoughts?

Lynne
12-28-2009, 03:21 AM
Are you doing a Force Refresh to force it to get the new css templates? If you aren't, then it will think they are already downloaded and continue to serve up the old ones. It does work for me. I've made changes at the top of the .css files to say what style they are in and I am getting the correct one per style:
/* Additional CSS2 - styleid2 */

Alien
12-28-2009, 04:44 PM
Yes, I've been using hard refreshes in Firefox 3.5.6.

I will try a couple of more times, it's really bugging me out!

Alien
12-28-2009, 04:48 PM
Just to be sure I'm clear on the instructions:

On the parent style, I edit the first additional css file and it all works perfectly.

Now on the child style, do I clear out the additional css and use additional css 2? Or do I just edit the first additional css file and just change the contents of the file from the old stuff there to the new css i need?

Alien
12-28-2009, 05:01 PM
I've tried all of the above, and no matter what I cannot load more than what is defined in the parent style. I've tried everything I can think of! I even attempted turning vbseo off thinking it was somehow rewriting a styleid URL. Grasping at straws...

Lynne
12-28-2009, 05:28 PM
Both css files get appended to your style. If you have stuff in additional_css2 from a parent style, it will get added to a child style unless you delete it. It acts just like any other template that inherits stuff from it's parent.

Alien
12-28-2009, 06:50 PM
I have a fully loaded additional_css in the parent, and then MOST of the same content (but a bunch of changed values) in the child style's additional_css2 file. It has not worked yet.

I've also tried keeping additional_css2 blank in the both parent and child, and just overwriting everything in the additional_css in the child style and that hasn't worked either.

I get the concept, I just really have no idea what could possibly be going on!

BSMedia
12-28-2009, 07:43 PM
Well the good news is that it's going to be default in 4.0.1

Lynne
12-28-2009, 08:29 PM
I have a fully loaded additional_css in the parent, and then MOST of the same content (but a bunch of changed values) in the child style's additional_css2 file. It has not worked yet.

I've also tried keeping additional_css2 blank in the both parent and child, and just overwriting everything in the additional_css in the child style and that hasn't worked either.

I get the concept, I just really have no idea what could possibly be going on!
Do you have a link? Are you putting something in the .css template to clearly state what style the template is in so when you view it from the browser window, you can tell?

Alien
12-29-2009, 12:04 AM
Lynne: I don't have a public link at the moment, as I'm editing together a new style behind the scenes.

I have added a comment to the CSS to identify that particular css clearly. When I view the page source, it links to the proper style id # but when you click the css call (in firefox) it displays the original one from the parent without my comment! I'll also try this with IE8 and Chrome to see if they have the same issue or if Firefox is doing something I've never seen before even though I'm hard refreshing *every* time.

Alien
12-29-2009, 12:11 AM
I got it to work with child styles.

In vB 3.8.x, I would be able to set "users can change styles" = no, and even have it turned off in the style manager and STILL be able to test and use it behind the scenes as an admin.

Now in 4.0.0 (gold), I noticed if you have it clicked "off" in the style manager it doesn't seem to load the custom css properly. It has to be selectable (which is not what I want until i'm ready)! I quickly turned all this on to test (then off so no one else could preview it) and I was able to get your modification to work brilliantly.

Thanks for helping and for your patience! I'm glad this is making it into 4.0.x!

Kevin McGowan
01-08-2010, 07:39 PM
Installed, great :)

Trek
01-14-2010, 03:01 AM
Just a heads up, this was added into 4.0.1, but isn't complete and basically doesn't work. So... this mod is still useful and well... works. ;)

Alex@Mk3OC
01-14-2010, 01:32 PM
As above, I thought I'd be able to use the new inbuilt one, but it did nothing so had to re-enable this one, think I'll just leave it installed tbh

Alien
01-14-2010, 04:22 PM
Even if it did work properly in 4.0.1, they don't setup child styles as eloquently as Lynne did unless I'm missing something. ;)

steve1966
01-21-2010, 09:09 AM
thanks

Alien
01-21-2010, 06:50 PM
Do you know of any way to make this compatible with external scripts that tie into the vB database such as Photopost? If you use this for your style css, you cannot get it to display in Photopost to my knowledge.

Lynne
01-21-2010, 07:09 PM
Do you know of any way to make this compatible with external scripts that tie into the vB database such as Photopost? If you use this for your style css, you cannot get it to display in Photopost to my knowledge.
I know absolutely nothing about photopost, so I can't answer your question.

Hall of Famer
04-07-2010, 05:21 AM
Does this one work for Vbulletin 4.02?

Alien
04-07-2010, 11:25 PM
Yes.

abouthere
04-13-2010, 08:05 AM
I'm really confused.

I've followed the instructions in the original post; however when I browse the default template in style manager, I don't have an additional_css.css file to edit.

If I need to create and upload this to the theme path, no problem, but where do I put it please?

Thanks!

Lynne
04-13-2010, 02:41 PM
If you uploaded the product, then the template should already be created for you and in the CSS Templates group.

ndut
05-31-2010, 07:03 PM
thank you

mmoore5553
06-19-2010, 07:43 AM
does this still work in 4.0.3 ? I am making edits and nothing happening. I have used this before on older versions just not on this one.

Lynne
06-19-2010, 02:42 PM
does this still work in 4.0.3 ? I am making edits and nothing happening. I have used this before on older versions just not on this one.
It works on 4.0.3, yes. However, they put in the template additional.css a couple of versions ago which is really what this modification was supposed to do until they added it.

mmoore5553
06-19-2010, 03:25 PM
thanks so much lynn. I still say you are always ahead of the game.

mmoore5553
08-01-2010, 05:45 AM
sorry to post this lynn but i was wondering ..i had style made for me and it works fine but with vb arcade mod, vbrookie and a couple others the css was not applied from the mod. I had to use your mod ...i modified it so it would look for vb original additional.css and it worked ...also i left it with what you had and copy and paste code in_css.css and it worked ...

How do i add this to vb so it works right without your mod ?

i have tried to add that one line of code everywhere ...

thanks but your mod works great but not sure why vb is not doing it right. I am on newest version.

can you tell me how to fix with just a line ..I looked in header include and looks like it is there in vb 4.0.6 and but does not look like it is applied to all pages , meaning mods ...

if not for your mod vbookie , the arcade mod , and one more would never have worked.

Lynne
08-01-2010, 02:06 PM
How do i add this to vb so it works right without your mod ?

i have tried to add that one line of code everywhere ...

thanks but your mod works great but not sure why vb is not doing it right. I am on newest version.
It is not vb not doing it right - it is your mods not doing it right. You will need to post in their threads and tell them what is happening (or not happening) and have them fix the issue.

mmoore5553
08-01-2010, 02:56 PM
oh okay thank you .... but once again you saved me with this mod ...i know i contacted the people that did those mods and they said it works on default so nothing is wrong but i noticed this happening.

Thanks again

Robbed
08-01-2010, 03:34 PM
Lynn these mods all work fine on the default skin.

It looks like any skin that uses additional.css doesn't display right when clicking on arcade, vbookie or gameroom.

Is this a VB issue or what would these mods have to do to fix it? We used your code and it works fine now.

Robbed
08-01-2010, 03:54 PM
I'm guessing these mods have to use this?

Basically, the "headinclude_bottom" template which contains a reference to additional_css.css, is supposed to be referenced in all the templates that reference the "headinclude" template.

Lynne
08-02-2010, 02:24 AM
Lynn these mods all work fine on the default skin.

It looks like any skin that uses additional.css doesn't display right when clicking on arcade, vbookie or gameroom.

Is this a VB issue or what would these mods have to do to fix it? We used your code and it works fine now.
I know absolutely nothing about any of those mods, so I really couldn't tell you why it isn't working. I am fairly certain thought that it is not a vb issue since I have written several custom pages and additional.css displays just fine on them.

sbsforum.us
08-23-2010, 08:25 PM
Thank you very much!! I spent hours trying to figure out how to make sure my css would work on everypage! This did it in 2 seconds!

synth19
10-04-2010, 06:51 PM
Hi all, I was trying to edit some of the CSS in order to change the text (circled in red). Anyone know how to change this or the css code needed? Thanks!

https://vborg.vbsupport.ru/external/2010/10/36.jpg

Lynne
10-04-2010, 07:04 PM
Hi all, I was trying to edit some of the CSS in order to change the text (circled in red). Anyone know how to change this or the css code needed? Thanks!

https://vborg.vbsupport.ru/external/2010/10/36.jpg
I already answered this question and told you to add some CSS (I posted the CSS for you, but can't remember it right now) into your additional.css template. That is an *existing* template, not this modification template. You would find it in with all your other templates under the CSS Templates group.

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

122742

122743

Thanks a million!

Margaret

Lynne
10-11-2010, 07:50 PM
Just add something like:
.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
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:


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

{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.


// 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
Update: do you mean this 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
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.


// 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:


// 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 $template_hook['headinclude_bottom_css'] to $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
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
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.


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

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
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
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
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 (http://www.forexmegacashback.com/forum)

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

Thanks