The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
css not showing up when css saved as file
What code do I need to add/modify to get my css template to show up when the setting save css stylesheets as file to true? The css in the template show up when the setting is false.
I'm guessing its a relatively simple change/addition but I'm not spotting it. EDIT: This is getting css for elements added to the postbit, not for a custom page |
#2
|
|||
|
|||
I'm not sure how you're adding your CSS template now, but if you use the function vB_Template::fetch_css_path() to build the url, it should work either way. For instance you could use $template_hook['headinclude_css'] like:
Code:
$template_hook['headinclude_css'] .= '<link rel="stylesheet" type="text/css" href="' . vB_Template::fetch_css_path() . 'my_css.css?d=' . $style['dateline'] . '" />'; or if you're putting it in a template you could just use {vb:cssfile my_css.css} . |
#3
|
||||
|
||||
Quote:
The first plugin is at the cache_templates with the following code: Code:
if(THIS_SCRIPT=='css') { $cache[] = 'my_css.css'; } Code:
if(in_array('vbulletin.css',$matches[1])) { $matches[1][] = 'my_css.css'; } |
#4
|
|||
|
|||
Quote:
Code:
if ($vbulletin->options['storecssasfile']) { $template_hook['headinclude_css'] .= '<link rel="stylesheet" type="text/css" href="' . vB_Template::fetch_css_path() . 'my_css.css" />'; } But there's one issue - this will load my_css.css on every page. If you can list the pages that actually need it, then you could limit it to those pages by also doing a check of THIS_SCRIPT. |
#5
|
|||
|
|||
There's another way to do it: create a cssrollup xml file and put it in includes/xml. For exaample you could name it cssrollup_myproduct.xml and have contents like this:
Code:
<?xml version="1.0" encoding="ISO-8859-1"?> <css product="my_product_id"> <rollup name="main-rollup.css"> <template>mycss.css</template> </rollup> </css> Then rebuild the styles (under Maintenance > General update tools). Then you don't need any extra code or plugins. Edit: There are other rollups than 'main', so if you're really concerned about efficiency, you could determined which one you need. There is one called 'postbit' so maybe that would work for you. |
Благодарность от: | ||
squidsk |
#6
|
||||
|
||||
Quote:
|
#7
|
|||
|
|||
Quote:
I agree, I think it's OK. Also, now that I see you're working on your product - I don't think you would need to rebuild the styles manually if the file is uploaded before the product is imported, so you shouldn't need any special instructions or anything. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|