[Typo3] Passing the current value to a user function intyposcript
Robert John de Stigter
robertjohn at bedrijvenweb.nl
Tue Oct 18 16:45:22 CEST 2005
Thanks,
I didn't know about the postUserFunc function. I got it working this
way:
--typoscript--
<TypoScript>
10 = TEXT
10 {
current = 1
postUserFunc = myclass->myfunction
}
</TypoScript>
--php--
function myfunction($value, $conf) {
/* the current value of the element is put in the first
variable given with the functions
*/
return ($value);
}
It didn't work with 10 = HTML.
So I changed
<proc type="array">
<HSC type="integer">1</HSC>
</proc>
To
<proc type="array">
<HSC type="integer">0</HSC>
</proc>
And ran the function htmlSpecialChars in my own function.
-----Oorspronkelijk bericht-----
Van: typo3-english-bounces at lists.netfielders.de
[mailto:typo3-english-bounces at lists.netfielders.de] Namens Farhdine
Boutzakhti
Verzonden: dinsdag 18 oktober 2005 12:44
Aan: TYPO3 English
Onderwerp: Re: [Typo3] Passing the current value to a user function
intyposcript
Robert John de Stigter wrote:
> Hi,
>
> In a templavoila datastructure I can add typoscript code to an
element.
> Like this:
>
> <TypoScript>
> 10 = TEXT
> 10.current = 1
> 10.case = upper
> </TypoScript>
>
> This will uppercase the value put in the form. But how can I pass the
> current value to a custom function?
> This doesn't seem to work.
> <TypoScript>
> 10 = USER
> 10.current = 1
> 10.userFunc = myclass->myfunction
> </TypoScript>
I think you can try this;
in TS:
<TypoScript>
10 = TEXT
10 {
postUserFunc = myclass->myfunction
postUserFunc.field = 1
}
</TypoScript>
and catch the field in your function:
function myfunction($content, $conf) {
// this will return '1'
return ($conf['field']);
}
_______________________________________________
Typo3-english mailing list
Typo3-english at lists.netfielders.de
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english
More information about the TYPO3-english
mailing list