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: KB TSConfig Conditions¶
Author: | Kasper Skårhøj |
---|---|
Created: | 2002-11-01T00:32:00 |
Changed by: | Bernhard Kraft |
Changed: | 2007-11-16T14:27:14 |
Author: | Kraft Bernhard |
Email: | kraftb@kraftb.at |
Info 3: | |
Info 4: |
EXT: KB TSConfig Conditions¶
Extension Key: kb_tsconfig_cond
Copyright 2005-2007, Kraft Bernhard, <kraftb@kraftb.at>
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: KB TSConfig Conditions 1
Introduction 1
What does it do? 1
Adminstration 1
Condition Syntax 1
Examples 2
Known problems 2
To-Do list 2
Changelog 2
Introduction¶
What does it do?¶
With this extension you will be able to use Conditions as known for Setup and Constants fields in the TSConfig of Users, Groups and Pages. At the moment this just works in the BE. So if there is Setup in some Pages TSConfig fields which gets used for frontpage rendering this will not go through the condition engine.
It works with User/Group TS-Config and Page TS-Config where the later one was just partly supported in the previous versions. There is a pending hook patch for TYPO3 4.1.3. When this patch gets into the core the extension will work for Page TS-Config without any modificatiosn. If the patch doesn't make into the next version you will have to apply a diff supplied with the extension (in the extension directory).
Adminstration¶
This section explains how those conditions get used. The syntax is the same as for Setup/Constants Conditions but with a little difference for the statements "usergroup" and "loginUser" as those are now for querying BE User/Group.
Condition Syntax¶
The syntax of an condition is
[Key = Value]
The possible Keys and their allowed values are listed in the following table:
browser¶
Key
browser
Values
msie,netscape
Description
The same as for Setup/Constants conditions. See TSRef on Conditions/Browser
version¶
Key
version
Values
4.03, >4
Description
The same as for Setup/Constants conditions. See TSRef on Conditions/Version
system¶
Key
system
Values
linux, mac
Description
The same as for Setup/Constants conditions. See TSRef on Conditions/System
device¶
Key
device
Values
robot, pda
Description
The same as for Setup/Constants conditions. See TSRef on Conditions/Device
useragent¶
Key
useragent
Values
Nokia7110*, Lotus-Notes*
Description
The same as for Setup/Constants conditions. See TSRef on Conditions/Useragent
language¶
Key
language
Values
en-us
Description
The same as for Setup/Constants conditions. See TSRef on Conditions/Language
IP¶
Key
IP
Values
123.*.*.*, 123.123.123.123
Description
The same as for Setup/Constants conditions. See TSRef on Conditions/IP
hostname¶
Key
hostname
Values
*.myhost.com, www..otherhost.com
Description
The same as for Setup/Constants conditions. See TSRef on Conditions/Hostname
hour¶
Key
hour
Values
5, >20
Description
The same as for Setup/Constants conditions. See TSRef on Conditions/Hour
minute¶
Key
minute
Values
10, <3
Description
The same as for Setup/Constants conditions. See TSRef on Conditions/Minute
dayofweek¶
Key
dayofweek
Values
0,1,2
Description
The same as for Setup/Constants conditions. See TSRef on Conditions/DayOfWeek
dayofmonth¶
Key
dayofmonth
Values
1,2,31
Description
The same as for Setup/Constants conditions. See TSRef on Conditions/DayOfWeek
month¶
Key
month
Values
1,2,12
Description
The same as for Setup/Constants conditions. See TSRef on Conditions/DayOfWeek
usergroup¶
Key
usergroup
Values
1,2,3
Description
This will check if the actually logged in BE User is in one of the specified Usergroups.
Example:
[usergroup = 2,3]
TCAdefaults.tt_content.hidden = 1
[end]
loginUser¶
Key
loginUser
Values
1,3,5
Description
This matches the UIDs of BE-Users.
[loginUser = 1,3,5]
will try to match the UID of the actually logged in User against 1, 3 or 5.
globalVar¶
Key
globalVar
Values
BE_USER:user:uid = 1
GP:id = 123
Description
With this condition key you can access any object which is available in $GLOBALS. To check if the actual user has UID 1 you can do the following.
[globalVar = BE_USER:user:uid = 1]
You will notice that it is similar to "loginUser" except that you have to specify the path to the "BE_USER:" uid in the global $BE_USER variable. So you should notice that you could make almost every check with "globalVar" (or "globalString")
Notice that values compared with globalVar are always Integers (Numbers). You will not be able to compare strings with this function. Use "globalString" instead.
"globalVar" further allows to check against values from GET/POST requests using the t3lib_div::_GP(..) function. You can access GP values with conditions like:
[globalVar = GP:id = 123]
This will check if the GET/POST variable "id" equals 123.
globalString¶
Key
globalString
Values
BE_USER:user:username=admin
GP:mystring = whatever
Description
This is similar to globalVar except that it does string matching. You can also access each variable of the $GLOBALS array.
Examples¶
Here are some examples of what you can do with TSConfig conditions.
Enter the following TS Code in the TSConfig of a User (not admin):
[globalVar = GP:id=123]
TCAdefaults.tt_content {
hidden = 1
}
[end]
With this code you have the following effect: The user can create content elemnts as usual. But if he creates a content element on the page 123 it will be hidden by default.
Applying the patch¶
For TYPO3 versions from 4.1.3 and later this isn't required.
For versions prior to 4.1.3 you wil have to apply a patch:
For Page TS Config Conditions to work a patch needs to get applied to t3lib/class.t3lib_befunc.php. This is necessary because some classes like t3lib_div and t3lib_BEfunc get called with the so called scope operator :: and not via an instance of a class which could get overwritten via XCLASSes.
The patch can get applied under UNIX with the default UNIX tool “patch” from the commandline via:
cd /webroot/mytypo3dir/t3lib/
patch -p 2 < /path/to/the/patch/patch_t3lib_befunc_tsconfigcond_2007-11-16.diff
It should report 2 hunks succeded.
Known problems¶
It will not work for FE rendering
To-Do list¶
Add support for Page/User/Group TSConfig conditions during FE Rendering.
Changelog¶
Version :¶
Version
Version :
Date
Date :
Changelog
Changelog :
0.0.1¶
Version
0.0.1
Date
( ? )
Changelog
Initial release
0.0.2¶
Version
0.0.2
Date
( ? )
Changelog
Added support for Page TS Config in the BE. Added a little Fix which fixed a problem which made the whole exension unusable from the installation on.
0.1.0¶
Version
0.1.0
Date
2006-03-13, 4:30 CET
Changelog
Now works with T3 4.0.0, Addes support for BE-User/Group conditions which are evaluated in the FE when doing FE-Editing.
0.2.0¶
Version
0.2.0
Date
2007-11-16, 14:30 CET
Changelog
Improved caching. Now TS-Config gets cached in all cases - achieved by using cache-mechanisms similar to those used for FE-TypoScript caching.Hook for T3 4.1.3 requested to avoid requirement of patching the core for Page TS-Config conditions to work.
EXT: KB TSConfig Conditions - 3