TypoScript condition examples

This will match with a url like “…&print=1”

[globalVar = GP:print > 0]

This will match with an url like “…&tx_ext_pi1[var1]=1”

[globalVar = GP:tx_ext_pi1|var1 > 0]

This will match with a remote-addr begining with “192.168.”

[globalString = ENV:REMOTE_ADDR = 192.168.*]

This will match with the page-id being higher than 10:

[globalVar = TSFE:id > 10]

This will match with the pages having the layout field set to “Layout 1”:

[globalVar = TSFE:page|layout = 1]

If the constant {$constant_to_turnSomethingOn} is “1” then this matches:

[globalVar = LIT:1 = {$constant_to_turnSomethingOn}]

This will match with netscape and opera-browsers

[browser = netscape, opera]

This will match if any BE-user is logged in:

[globalVar = TSFE : beUserLogin > 0]

This matches logins from users members of groups with uid’s 1 and/or 2:

[usergroup = 1,2]

This will match on any FE-user (because every FE-user has an usergroup)

[usergroup = *]

better:

[loginUser = *]

This matches logins from special users uid’s fe_users-uid1 and/or fe_users-uid2, …:

[loginUser = fe_users-uid1, fe_users-uid2, ...]

This checks if one of the figures in “pages-uidl” is a PID (pages-uid) in the rootline:

[PIDinRootline = pages-uid, pages-uid, ...]

Do the same as PIDinRootline, except the current page-uid is excluded from check.

[PIDupinRootline = pages-uid, pages-uid, ...]

This checks the domain in two ways. As the first does not really work I prefer the second:

[hostname = mydomain.tld] || [globalString = IENV:HTTP_HOST = mydomain.tld]

This ends any conditions:

[end]

or this:

[global]