PDA

View Full Version : Include another default CSS template via plug-in


GreenT
01-27-2010, 02:51 PM
Hi,

I would like to include the album.css styles on FORUMDISPLAY pages. Is there a way to achieve this via a plug-in?

I'm aware that I could inject the stylesheet into the header, but I would like it to be compatible with both embedded and outsourced (filesystem) CSS.

Thanks!

Marcus

Paul M
01-27-2010, 08:08 PM
Any method atm will almost certainly change in 4.0.2, so best to wait.

Lynne
01-27-2010, 08:14 PM
There is an article in the vb4 articles forum that you may want to read. But, as Paul said, things may change a bit... I know there is a template_hook available right now but exactly how it is to be used may change.

GreenT
01-28-2010, 05:01 AM
Okay, thanks then... I'll wait.

MrNase
03-14-2010, 05:56 PM
Any news on this?

I would like to use one CSS template from 'showthread' in 'newthread' - how is the script told what CSS template to use on what page? :)

Lynne
03-14-2010, 11:23 PM
Several ways to do it. One way..

hook location - parse_templates
if (THIS_SCRIPT == 'xxxx') {
if ($vbulletin->options['storecssasfile'])
{
$vbcsspath = 'clientscript/vbulletin_css/style' . str_pad($style['styleid'], 5, '0', STR_PAD_LEFT) . $vbulletin->stylevars['textdirection']['string'][0] . '/';
}
else
{
// textdirection var added to prevent cache if admin modified language text_direction. See bug #32640
$vbcsspath = 'css.php?styleid=' . $style['styleid'] . '&langid=' . LANGUAGEID . '&d=' . $style['dateline'] . '&td=' . $vbulletin->stylevars['textdirection']['string'] . '&sheet=';
}
$template_hook['headinclude_bottom_css'] .= '<link rel="stylesheet" type="text/css" href="'.$vbcsspath.'yyyy.css" />';
}

Change xxxx and yyyy as needed.

MrNase
03-15-2010, 08:40 PM
Thanks for your answer. :)

Depending on what page I am, vBulletin knows what CSS templates to include - what controls this behaviour?

I was hoping the only thing I need to do is add something to an array (like what you do when you want to add a custom template to the cache) and it just works. I mean.. there must be something that is responsible for the default CSS templates.

Don't get me wrong, there is basically nothing wrong with your solution but it has one flaw: It links to another CSS file - the stock installation composes many different files into one and that's what I am trying to achive. (less files - more speed). :)

Lynne
03-17-2010, 02:26 AM
If you know you are not going to be storing css in the file system, then you can use the template_hook custom_css_list (in headerinclude template) to add to the list of templates.