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

Nyeki Attila thewondererus at yahoo.com
Wed Jul 27 08:58:48 CEST 2005


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