DEPRECATION WARNING
This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.
EXT: conditions¶
Author: | Kasper Skårhøj |
---|---|
Created: | 2002-11-01T00:32:00 |
Changed by: | Simon Tuck |
Changed: | 2005-05-23T13:23:18 |
Email: | lolak@lolak.com |
EXT: conditions¶
Extension Key: con ditions
Copyright 2000-2002, , <lolak@lolak.com>
This document is published under the Open Content License
available from http://www.opencontent.org/opl.shtml
The content of this document is related to TYPO3
- a GNU/GPL CMS/Framework available from www.typo3.com
Table of Contents¶
EXT: conditions 1
Introduction 1
What does it do? 1
Syntax 1
OR Operators 1
AND Operators 2
Operator Precedence 2
TypoScript Reference 2
Examples 2
Known problems 2
Changelog 2
Introduction¶
In the document 'TypoScript Syntax and In-depth Study' ( http://typo3.org/documentation/document-library/doc_core_ts/ ) Kaspar details the code that is necessary to extend the capabilities of the TypoScript condition syntax. This extension adds these capabilities to TypoScript and includes some additional conditions.
What does it do?¶
This extension expands the capabilities of conditions in TypoScript. By default conditions strung togethor in TypoScript are evaluated with boolean OR. For example the following snippet will evaluate to TRUE if your browser is Internet Explorer OR if your system is a Mac:
[system = mac ][browser = msie]
some typoscript...
[global]
The extended TS condition syntax will allow you to identify situations where the client is an Internet Explorer AND a Mac system:
[system = mac ] && [browser = msie]
some typoscript...
[global]
Furthermore, the extension offers the following additional conditions:
- BEloginUser: Checks to see if the spedified backend user is logged in- BEusergroup: Checks to see if the spedified backend usergroup is logged in
Syntax¶
OR Operators¶
OR Conditions can be included in two ways. The standard syntax assumes an OR condition, alternatively the double pipe defines an OR condition as well:
[ condition 1 ][ condition 2]
(Some TypoScript only parsed if cond. 1 or cond. 2 are met)
[GLOBAL]
[ condition 1 ] || [ condition 2]
(Some TypoScript only parsed if cond. 1 or cond. 2 are met)
[GLOBAL]
AND Operators¶
AND Conditions are defined using the double ampersand logical AND operator:
[ condition 1 ] && [ condition 2]
(Some TypoScript only parsed if cond. 1 and cond. 2 are met)
[GLOBAL]
Operator Precedence¶
The OR condition is the weak operator so AND will always take precendence over OR, thus:
[cond 1] && [cond 2] || [cond 3] && [cond 4]
Implies the following parenthesis:
( [cond 1] && [cond 2] ) || ( [cond 3] && [cond 4] )
TypoScript Reference¶
For a complete reference of the available values for conditions refer to chapter 4 of TSref ( http://typo3.org/documentation/document- library/doc_core_tsref/Condition_reference/ )
The following additional conditions are available:
BEusergroup¶
Key
BEusergroup
Values & Syntax
Uid of a logged in backend user group or an asterisk for any login
[BEusergroup = 1,2] matches any login from backend user groups with uid 1 or 2
[BEusergroup = *] matches any login by a backend user group.
BEloginUser¶
Key
BEloginUser
Values & Syntax
Uid of a logged in backend user or an asterisk for any login
[BEloginUser = 1,2] matches any login from backend users with uid 1 or 2
[BEloginUser = *] matches any login by a backend user.
[tsref:(cObject).TEST]
Examples¶
Provide an alternate template for:- any Netscape browser version less than 5.
page.10 < temp.myTemplate
[browser = netscape] && [version =< 5]
page.10 < temp.alternateTemplate
[global]
Provide an alternate template for :- any Netscape browser version less than 5- OR any Internet Explorer on a Mac system- OR any Internet Explorer version less than 5
page.10 < temp.myTemplate
[browser = netscape] && [version =< 5] || [system = mac] && [browser = msie] || [browser = msie] && [version =< 5]
page.10 < temp.alternateTemplate
[global]
Known problems¶
The class extends the class t3lib_matchCondition. It will likely conflict with any extension that does the same.