[TYPO3-english] Add conditional CSS through Templavoila

Erik Svendsen erik at linnearad.no
Mon Feb 23 14:47:30 CET 2009


Hello Dmitry,

> Hi!
> 
> Erik Svendsen wrote:
> 
>> But I will advise you to not include the stylesheet through
>> Templavoila. I think it's better to use page.HeaderData beacuse it
>> gives you better controll over the order of CSS-files and also other
>> elements in the header. Also the use of page.includeCSS is possible
>> to have the CSS-files in correct order. But it don't give the
>> possibility to use conditional comments. But condition in TYPO3 gives
>> you the possibility to serve different stylesheets to different
>> browsers.
>> 
> The recommendation above goes against the official TemplaVoila
> recommendations. It will not work if there many different templates
> for the same data source. When template is changed, that TS will have
> to be updated too. If CSS is mapped as header parts, TV takes care
> about it.
> 

I know that my recommendation is against official TemplaVoila recommendation. 
But I have found that the use of page.headerData is a better solution for 
my use. Mostly because I want strict controll also of the <head> part. Even 
the implementing of javascript from extensions.

And I'm using it also where i have different templates for same DS. Of course 
it gives some overhead in the css-files, but it has never given me any problem 
when updating TV templates. As long as you link to correct CSS-file with 
correct content, where you it link does not make any difference. 

I have to correct myself a bit. I looks like the order of stylesheets when 
using page.includeCSS, mapped as header part in TV and page.headerData are 
like written here when using TYPO3 4.2.6. I older versions of TYPO3 it looks 
like the CCS-files mapped in TV header part are listed after page.headerData. 
Which are the main reason for me using page.headerData. I often using "generic" 
HTML templates on different sites, where I override part of the CSS with 
one CSS-file. The official recommendation was here more and less unusable.

The official recommendation are now usable, but still the page.includeCSS 
comes before the TV CSS. TV CSS should always be the first stylesheets in 
the header. 

> The issue with conditional comments in TV is fixed by Steffen Kamper
> and will appear in the next TV version.
> 

Good!

WBR,
Erik Svendsen
www.linnearad.no




More information about the TYPO3-english mailing list