[TYPO3-mvc] FLUID :: object accessor syntax :: nested objects possible?
Benjamin Kott
info at bk2k.info
Fri Jun 29 14:01:29 CEST 2012
Hey you could try something like this.
{namespace myview=Tx_MyExt_ViewHelpers}
{myview:display(obj: object, prop: some.uid)}
<?php
class Tx_MyExt_ViewHelpers_DisplayViewHelper extends
Tx_Fluid_Core_ViewHelper_AbstractViewHelper {
/**
* @param $obj object Object
* @param $prop string Property
*/
public function render($obj,$prop) {
if(is_object($obj)) {
return $obj->$prop;
} elseif(is_array($obj)) {
if(array_key_exists($prop, $obj)) {
return $obj[$prop];
}
}
return NULL;
}
}
?>
Best regards,
Benji
Am 29.06.2012 10:41, schrieb Steffen Roßkamp:
> Hi Roland
>
> If you don't mind installing another (excellent) extension
>
> http://fedext.net/fed-viewhelpers/variables/function-call.html
>
> might help you with this.
>
> Best regards,
>
> Steffen
>
> On 6/29/12 10:14 AM, Roland wrote:
>> hi lorenz,
>>
>> thanks. ok, so i will have to use a viewhelper to solve my problem i guess?
>>
>> roland
>>
>>
>>
>> Am 29.06.12 10:12, schrieb Lorenz Ulrich:
>>> Hi Roland
>>>
>>> It won't work.
>>>
>>> Best regards,
>>>
>>> Lorenz
>>>
>>> Am 29.06.2012 10:12, schrieb Roland:
>>>> hi everybody,
>>>>
>>>> i guess something like this will not work?
>>>>
>>>> --- quote ---
>>>> {foo.bar.{baz.bar}.{zoom.dock}}
>>>> --- /quote ---
>>>>
>>>> it does not work for me but i am not sure if i had an error somewhere i
>>>> can not see...
>>>>
>>>> kind regards
>>>>
>>>> roland
>>>
>>
>>
>> _______________________________________________
>> TYPO3-project-typo3v4mvc mailing list
>> TYPO3-project-typo3v4mvc at lists.typo3.org
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
>
--
Sonnige Grüße
Benji
More information about the TYPO3-project-typo3v4mvc
mailing list