[Typo3] pass 2 values from 10.data to userfunc

Dmitry Dulepov typo3 at fm-world.ru
Thu Jul 28 07:03:06 CEST 2005


Hi!

Actually I was interested in this problem too and I tried this approach
yeasterday. It does not work. :( It seems that userFunc is execute
*before* all "insertData" is processed. $conf will contain the values as
specified in TS.

Dmitry.

Nyeki Attila wrote:
> 
> I just noticed that this is all about a userFunc.
> I've always used this "insertData" thing in content/page rendering, not
> in parameters for user functions.
> 
> But I have an idea, try this:
> 
> temp.x = TEXT
> temp.x.value = {field:field_listtext}
> temp.x.insertData = 1
> 
> and then:
> 
>      10 = USER
>      10 {
>          userFunc = user_linkmarker->main
>          data < temp.x
>      }
> 
> I'm not sure that this is the right way in Typo3 but it could work.
> 
> I also found an example in Modern Template Building, Part 1 documentation:
> 
> 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
> 
> 
>> Nyeki Attila schrieb:
>>
>>> use { brackets
>>> {field:field_listtext}
>>>
>>> i'm not 100% sure but I thing they are required
>>>
>>>> Attila
>>
>>
>>
>> Thats my complete code now...
>>
>> includeLibs.linkmarker= fileadmin/includes/class.user_linkmarker.php
>>
>> lib.linkmarker= COA
>> lib.linkmarker {
>>     10 = USER
>>     10 {
>>         userFunc = user_linkmarker->main
>>         data = {field:field_listtext}
>>         insertData = 1
>>     }
>>
>>
>> The stuff with the brackets - yeah - thats what I found in some
>> tutorial, but even with brackets and insert Data ist still does not work.
>>
>> grrr this drives me crazy...
>> =)
>>
>> Yes, I checked the field name of "listtext" in the DS, its alsso
>> running into the main function...I also cleares both(!) caches and the
>> temp_Cached under typo3conf
>>
>> I am at a loss...
>>
>> :-(



More information about the TYPO3-english mailing list