[Typo3] Add css with ts on a single page

Mathias Schreiber [wmdb] mathias.schreiber at wmdb.de
Thu Dec 1 13:30:41 CET 2005


Vlatko Šurlan wrote:
> Hi list. I need to add simple css on one specific page. Can anyone 
> please give me an instruction on how to do it, or, even better, point me 
> to the documentation where I could figure this out my self. Thanks!

Check conditions.
You can do numerous cool things with them.

Example:
[globalVar = TSFE:id = 10]
page.includeCSS = fileadmin/templates/myOtherCssFile.css
[end]

This works, but only on your page with the ID 10.
If an editor changes the UID (by deleting and re-creating the page) your 
condition wil (of course) not work.

So you could use something like this:
[globalVar = TSFE:page|layout = 1]
page.includeCSS = fileadmin/templates/myOtherCssFile.css
[end]

This would make the CSS load whenever the layout switch in the page 
header is set to "Layout 1".

What if you have used the layout switch already?
Build an extension with the kickstarter that adds a new field to the 
table "pages" and make it of the type "checkbox".

In the pageheader you will have a checkbox then (sounds clear, I guess).
Then modify your condition:
[globalVar = TSFE:page|tx_myExtension_fieldname = 1]
page.includeCSS = fileadmin/templates/myOtherCssFile.css
[end]

see?
Conditions are cool.

all the best
Mathias

-- 
if ($GLOBALS['TSFE']->fe_user->user['ahnung'] == 0) {
	$this->fresseHalten = 1;
}



More information about the TYPO3-english mailing list