[TYPO3-english] confused with some example codes
tom
typostudy at gmail.com
Wed Nov 7 15:00:38 CET 2012
Hi,
Below info is from Modern Template Building, Part 1 (MTB/1). Although there
is explanation for the code, but I still have some questions.
*First, lets create a PHP-file in fileadmin/userfunctions.php:
<?php*
*class user_functions {*
* /**
* Multiplies the current page ID with $conf["factor"]
*/
function multiplyTest($content,$conf) {
$currentPageUid = $GLOBALS['TSFE']->id;
$factor = intval($conf['factor']);
return $currentPageUid * $factor;
}
}
?>*
*Then lets configure a cObject of the type USER to call this function with
a single parameter, "factor":
# Default PAGE object:
page = PAGE
page.typeNum = 0
page.includeLibs.some_random_id_string = fileadmin/userfunctions.php
page.config.admPanel = 1*
*# Content object outputting current page title:
page.10 = HTML
page.10.value = The page ID, {field:uid}, multiplied with 15 is:
page.10.value.insertData = 1
page.10.value.wrap = <b> |</b> <br />*
*page.20 = USER
page.20.userFunc = user_functions->multiplyTest
page.20.factor = 15*
**
My questions:
1. page.includeLibs.some_random_id_string = fileadmin/userfunctions.php
what is the meaning of .some_random_id_string? I changed it to some_random,
it still works.
2. page.10.value.insertData = 1
what is the meaning of .insertData? I read TypoScript Reference, but still
do not understand.
3. what is the value of $content and $conf? is $content,$conf array or
object? what are the values inside $content, $conf?
Thanks.
Tom
More information about the TYPO3-english
mailing list