[TYPO3-english] confused with some example codes

Stefan Reichelt eichelt at web.de
Wed Nov 7 20:44:14 CET 2012


Hello Tom,

1. It is a name/key/ID for the library/file you put into includeLibs. 
Kinda like with an array.
2. inserData tells typoscript to replace the 'markers' (this probably 
the wrong name but
anyway), like in your example the {field:uid}, with the data they... 
represent.
3. As far as I remember $content contains the content already created in 
the content object
that is calling the function (in your example page.20) and $conf 
contains its typoscript setup.

Kind regards,
Stefan


On 07/11/2012 15:00, tom wrote:
> 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
> _______________________________________________
> TYPO3-english mailing list
> TYPO3-english at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
>



More information about the TYPO3-english mailing list