vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Include another default CSS template via plug-in (https://vborg.vbsupport.ru/showthread.php?t=234296)

GreenT 01-27-2010 02:51 PM

Include another default CSS template via plug-in
 
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
PHP Code:

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.


All times are GMT. The time now is 10:02 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00957 seconds
  • Memory Usage 1,731KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete