[TYPO3-dev] add custom CSS to module

Tapio Markula tapio.markula at atwebteam.com
Wed Mar 7 15:12:49 CET 2007


Markus Wagner kirjoitti:
> Hi!
> 
> Tapio Markula wrote:
>> That is *bad* - note that several application may use 'inDocStylesArray'.
> 
> Sorry, I can't follow you. You have seen the hidden array_push in the
> following line? 
> 
> $this->doc->inDocStylesArray[] = '@import url( ... );';
> 
>> If some plugin uses it *before* you plugin the import statement doesn't
>> work!
> 
> Why this?

several plugins might add CSS using
$this->doc->inDocStylesArray[]

Lets imagine that plugin A is installed before you plugin and it adds

body#abc {... }

Then your plugin adds
@import url(....)

CSS, which has been added by your plugin doesn't work

the result is
<style...
body#abc {... }
@import url(...


@import-statement should *always be on the top of any other CSS -
just comments can be before it. If it is not on top, it is ignored.
I found this problem with erotea_date2cal, which used @import statement
- and didn't work because my plugin put new CSS *before* the @import 
statement.

Include instead using PHP, for example like this

$this->doc->inDocStylesArray[] = 
t3lib_div::getURL(t3lib_extMgm::extPath($_EXTKEY).'yourImportedCss.css');




More information about the TYPO3-dev mailing list