[TYPO3-english] TScript Condition NOT operator?

Martin Mädler martin.maedler at rwth-aachen.de
Fri Apr 15 10:14:44 CEST 2011


Am 14.04.2011 09:08, schrieb Martin Mädler:
> Hello,
>
> I haven't seen this documented anywhere, but I ran into a problem 
> where I need a NOT operator in one of my conditions. Since it is not 
> possible to nest conditions, I broke mine up into 3 seperate 
> conditions. The logic should work like this:
>
> [loginUser = 1] # if user 1 is logged in (IP not relevant)
>   temp.submenu.excludeUidList = 118
> [IP = 12.345] && [loginUser = !1] # if IP starts with 12.345 and no 
> user is logged in
>   temp.submenu.excludeUidList = 97
> [else] # IP doesn't match and not logged in (there is only one fe-user)
>   temp.submenu.excludeUidList = 97, 118
> [global]
Hello, I could solve the problem with the aid of a "userFunc" (see code 
below).
Moreover, it is possible to check if no user is logged in with this 
syntax [loginUser = ]. It is just not documented ;)

[loginUser = 1]
   temp.submenu.excludeUidList = 118
[IP = 12.345] && [loginUser = ]
   temp.submenu.excludeUidList = 97
[loginUser = ] && [userFunc = user_notIP(12.345)]
   temp.submenu.excludeUidList = 97, 118
[global]

function user_notIP($value) {
     if (t3lib_div::cmpIP(t3lib_div::getIndpEnv('REMOTE_ADDR'), $value)) {
         return FALSE;
     }
     // else
     return TRUE;
}

I pasted this function at the end of typo3conf/localconf.php.

Best Regards
Martin


More information about the TYPO3-english mailing list