[TYPO3-templavoila] using userFunc inside DS

Ron Hall ronslists at busynoggin.com
Mon Jul 6 03:36:21 CEST 2009


One addition. Email broke the last php statement into two lines. It  
should be one line.
Ron

On Jul 5, 2009, at 8:33 PM, Ron Hall wrote:

> Hello Martin,
>
> This is what I use to retireve the header field of an FCE and render
> it on the front end. This should be similar to what you can do for
> your need
>
> In the main TS template I have:
>
> includeLibs.bn_utilities = fileadmin/bin/utilities.php
>
> # fce header rendering INSIDE fce
> retrieveHeader = USER
> retrieveHeader {
> 	userFunc = user_header->retrieveHeader
> 	renderObject = TEXT
> 	renderObject.field = header
> 	renderObject.stdWrap.htmlSpecialChars = 1
> }
>
>
> In the utilities.php file I have:
>
> <?php
> class user_header {
> 	var $cObj;
>
> 	function retrieveHeader($content, $conf) {
> 		$cObj = t3lib_div::makeInstance('tslib_cObj');
> 		$cObj->start($this->cObj->parentRecord['data'], 'tt_content');
>
> 		return $cObj->cObjGetSingle($conf['renderObject'],
> $conf['renderObject.']);
> 	}
> }
> ?>
>
> Of course, I map the retrieveHeader object in the DS.
>
> Ron Hall
> Busy Noggin, Inc.
>
>
> On Jul 5, 2009, at 4:51 PM, Martin Rebetez wrote:
>
>> Hi Francois,
>>
>> I missed your answer and just see it right now.
>> So I will try tomorrow and will give you a feedback...
>>
>>
>> Martin
>>
>> Francois Suter a écrit :
>>> Hi,
>>>
>>>> The displayed code is then 'USER' and not my expected value from my
>>>> function...
>>>>
>>>> Can you help me to understand my mistake ?
>>>
>>> First of all, the temp object cannot be used with TemplaVoilà. You
>>> should use the lib object instead. Anyway the FCE is not the place  
>>> to
>>> declare such an object. It should be in your main TS template.
>>>
>>> Anyway why don't you do 20 = USER right away?
>>>
>>> I must say I've never tried using user functions directly inside a
>>> FCE,
>>> but it sure works at a "lower" level. See for example the code used
>>> by
>>> kb_tv_contslide:
>>>
>>>   10= RECORDS
>>>   10.source.postUserFunc = tx_kbtvcontslide_pi1->main
>>>   10.source.postUserFunc.field = field_banner
>>>   10.source.postUserFunc.languageFallback = 0
>>>   10.tables = tt_content
>>>   10.wrap = <!--TYPO3SEARCH_begin--> | <!--TYPO3SEARCH_end-->
>>>
>>> So if using USER directly is not possible, then it should
>>> definitely be
>>> possible to do something like:
>>>
>>> 10 = TEXT
>>> 10.preUserFunc = ...
>>>
>>> or
>>>
>>> 10 = TEXT
>>> 10.cObject = USER
>>>
>>> but if that works on not directly
>>>
>>> 10 = USER
>>>
>>> I would think there's a bug.
>>>
>>> HTH
>>>
>> _______________________________________________
>> TYPO3-project-templavoila mailing list
>> TYPO3-project-templavoila at lists.netfielders.de
>> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-project-templavoila
>>
>
> _______________________________________________
> TYPO3-project-templavoila mailing list
> TYPO3-project-templavoila at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-project-templavoila
>



More information about the TYPO3-project-templavoila mailing list