TSRef - TypoScript Reference

4.1.22. userFunc:

Syntax:

  [userFunc = user_match(checkLocalIP)]

 

Comparison:

This call the function "user_match" with the first parameter "checkLocalIP". You write that function. You decide what it checks. Function result is evaluated as true/false.

Example:

Put this function in your localconf.php file:

 

  function user_match($cmd)    {
      switch($cmd)    {
          case "checkLocalIP":
              if (strstr(getenv("REMOTE_ADDR"),"192.168"))    {
                  return true;
              }
          break;
          case "checkSomethingElse":
              // ....
          break;
      }
  }

 

This condition will return true if the remote address contains "192.168" - which is what your function finds out.

      [userFunc = user_match(checkLocalIP)]

 


Valid XHTML 1.0!