TSref/USER
From TYPO3Wiki
| TypoScript Referenz - USER |
|
||||
This page is document in progress. TypoScript
USER and USER_INT
This calls either a PHP-function or a method in a class. This is very useful if you want to incorporate you own data processing or content.
Basically this a userdefined cObject, because it's just a call to a function or method you control!
An important thing to know is that if you call a method in a class (which is of course instantiated as an object) the internal variable 'cObj' of that class is set with a reference to the parent cObj. See the example_callfunction.php file for an example of how this may be usefull for you. Basically it offers you an API of functions which are more or less relevant for you. Refer to the “Include PHP scripts” section in this document.
It's a little like the PHP_SCRIPT concept but this is somehow cleaner, because it's a call to a function previously defined and not an inclusion of a PHP-script file. So this is recommended.
If you create this object as USER_INT, it'll be rendered non-cached, outside the main page-rendering. See the PHP_SCRIPT_INT for details as this is the same concept used there.
| Property: | Data type: | Description: | Default: |
| userFunc | function-name | The name of the function. If you specify the name with a '->' in, it's intepreted as a call to a method in a class.
Two parameters are sent: A content variable (which is empty in this case, but not when used from stdWrap function .postUserFunc and .preUserFunc) and the second parameter is an array with the properties of this cObject if any. Example: This TypoScript will display all content element headers of a page in reversed order. Please take a look in media/scripts/example_callfunction.php!! (Also demonstrated on the testsite, page page = PAGE
page.typeNum=0
includeLibs.something = media/scripts/example_callfunction.php
page.30 = USER
page.30 {
userFunc = user_various->listContentRecordsOnPage
reverseOrder = 1
}
| |
| includeLibs | list of resource | (This property applies only if the object is created as USER_INT)
This is a comma-separated list of resources that are included as PHP-scripts (with include_once() function) if this script is included. This is possible to do because any include-files will be known before the scripts are included. That's not the case with the regular PHP_SCRIPT cObject. |
[tsref:(cObject).USER/(cObject).USER_INT]
