[TYPO3] assign return-value of a userfunc via TS to a attribute

Dmitry Dulepov [typo3] dmitry at typo3.org
Thu Sep 11 10:10:53 CEST 2008


Hi!

Markus Thaler wrote:
> i have got a problem to assign the return-value of a userfunc via TS to 
> a attribute.
> 
> ------------------------
> this (simplyfied) szenario does not work:
> 
> ### TS ###
> includeLibs.id = fileadmin/scripts/id.php
> temp.id = USER
> temp.id.userFunc = user_id->main
> temp.gallery < plugin.tx_rgsmoothgallery_pi1
> temp.gallery {
>  mode = RECORDS
>  startingpointrecords < temp.id
>  }
> }

This willo not work because TS is not executable language. The copy operator "<" just copies whatever you have on the right part of it. After copying your TS becomes:


includeLibs.id = fileadmin/scripts/id.php
temp.id = USER
temp.id.userFunc = user_id->main
temp.gallery < plugin.tx_rgsmoothgallery_pi1
temp.gallery {
  mode = RECORDS
  startingpointrecords = USER
  startingpointrecords.userFunc = user_id->main
}

Now when SmoothGallery tries to read "startingpointrecords", it expects a number there. But actually it finds a word "USER" there. See the problem?

There is nothing you can do here. Only real number will do. For example, your other code fragment works because it actually sets the number to this property:

> temp.id = 9
> temp.gallery < plugin.tx_rgsmoothgallery_pi1
> temp.gallery {
>  mode = RECORDS
>  startingpointrecords < temp.id
> } 

The solution would be to enable stdWrap for this property in the extension. If you report a feature request for it, it can be done for future releases.

-- 
Dmitry Dulepov
TYPO3 Core team
My TYPO3 book: http://www.packtpub.com/typo3-extension-development/book
In the blog: http://typo3bloke.net/pages/book-reviews/presentation-zen-by-garr-reynolds/


More information about the TYPO3-english mailing list