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:
yes, this article is now obsolete. You can now just use the headinclude_bottom_css hook to add your stylesheets. It would probably be even better if there was a hook into additional.css as well. As I wrote above, this was mostly for people working with the beta at the time of this writing.
If you still want to use this method, you can add a conditional to add the call for the static files in the template hook above only in case static CSS is enabled. But this would be really useless, I think.
$set = $vbulletin->db->query_read($sql = " SELECT DISTINCT title FROM " . TABLE_PREFIX . "template WHERE styleid IN (" . $parentlist . ") AND title LIKE '%.css' ");
My css template like *.css. But in CSS file I don't see it. Is It a bug?
No, if you read the file further, you will see that the result of the query is used only to generate the css file into the directory. After that, you still have to add the path to the headinclude, as I said above. That is why I said the method in the article is still valid, but you need also to add the link to the CSS file... which makes the whole purpose of this article meaningless
A way of having your custom CSS added to the generated files would be to assign it a template type of "css"; but I think you can do this via XML file only (or query), and I am not sure of consequences as I have not explored the possibility.
In brief, easier to use a simple template hook, even though I can understand that some want to have products self contained in an XML file. This would be possible if the developers added a template hook into additional.css.
No, if you read the file further, you will see that the result of the query is used only to generate the css file into the directory. After that, you still have to add the path to the headinclude, as I said above. That is why I said the method in the article is still valid, but you need also to add the link to the CSS file... which makes the whole purpose of this article meaningless
A way of having your custom CSS added to the generated files would be to assign it a template type of "css"; but I think you can do this via XML file only (or query), and I am not sure of consequences as I have not explored the possibility.
In brief, easier to use a simple template hook, even though I can understand that some want to have products self contained in an XML file. This would be possible if the developers added a template hook into additional.css.
What's about open new project for that in vbulletin.com ? I think it will be very nice to use template hooks also we want our products automatically installation.