[TYPO3-english] custom TS conditions

Tomasz Krawczyk tomkrawc at gmail.com
Fri Nov 25 14:43:06 CET 2011

W dniu 2011-11-25 14:17, Victor Livakovsky pisze:
> Hi, Tomasz.
>> From TS syntax in-depth study I know that I can parse my TS and add
>> custom conditions like [TYPO3 IS GREAT]. The problem is that I don't
>> know how to tell TYPO3 about my class. Such conditions looks more
>> interesting to me than userFunc.
>> Can you help me?
> As far, as I understood this may be used in your custom TS area - not in
> global TS templates. F.e. you have some textarea in flexform of your
> extension, where you allow editors to put raw TS. So, you can access
> this field from your PHP code and invoke t3lib_tsparser with your
> conditions checker object. You can find a real-life example in tt_news
> extension - there is an area on last tab of FF, where you can put TS
> code (but tt_news doesn't have some special conditions defined fot this
> purpose).
> So, conclusion: custom conditions may be used only in your own
> extensions, userFunc should be used in normal TS.
> Correct me somebody, if I'm wrong,

I'm working on an extension for mobile site and I would like to prepare 
pages for mobile device capabilities. So, I need global conditions.

I would like to achieve such conditions:

[screen_width > 400]
// show big logo
[screen_width > 300]

[browser_name = IEMobile] && [supported_images = gif,jpg]
// do sth.
[browser_name = Opera Mini] && [browser_version > 5.2]
// do sth. else
[os = Android]
// do sth. else

You know, userFunc is not as comfortable and elegant ;-)


More information about the TYPO3-english mailing list