[HOW TO - VB4] Adding Stylesheets to Your vB4 Mod via Plugins
by
25 Nov 2009
THIS ARTICLE IS NO LONGER NEEDED FOR vB 4.0.0+: you can now just use the hook in the headinclude_bottom template: headinclude_bottom_css. As I wrote at the beginning of this tutorial, this was to help people working with beta versions. As many coders have noticed, we still don't have a template hook in headinclude to add our own CSS to the css.php call in the template. Additionally, the simple method I am listing here might still be useful in the future, even when we get that hook. One of the great things of the new vBulletin, in fact, is that you can manipulate CSS generation as you have been used to in your scripts. Here you go. 1. First, add a template in Style & Templates, and assign it to your product in development. Let's call this template yourproduct.css. 2. Now, add a plugin for your product for caching this template. Go to Plugin Manager -> Add Plugin, call the plugin as you prefer, then choose the cache_template hook, and finally put the following code in it: Code:
if(THIS_SCRIPT=='css') { $cache[] = 'yourproduct.css'; } Code:
if(in_array('vbulletin.css',$matches[1])) { $matches[1][] = 'yourproduct.css'; } That's it - your CSS will be added to the generated CSS file. |