[TYPO3-german] [Fluid]Variable zusammbauen {array.{key}}
Kay Strobach
typo3 at kay-strobach.de
Sun Sep 18 12:35:54 CEST 2011
Hi Alex,
<?php
class Tx_Ksapiclient_ViewHelpers_DispViewHelper 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;
}
}
?>
Namespace (kann anders sein...)
{namespace h=Tx_Ksapiclient_ViewHelpers}
Verwendung wie folgt:
{h:disp(obj: results, prop:'fachBeschreibung')}
Nutzt die Variable Results und dort den Key fachBeschreibung, wenn du
eine Variable als Key nutzen willst, musst du einfach die '' weglassen.
Wichtig HSC oder rteparsefunc, musst du extra aussenrum schreiben, sonst
wird kein escaping gemacht.
Grüße
Kay
Am 18.09.2011 10:55, schrieb Alexander Walther:
> Hi Kay,
>
> danke für das Angebot, ich hoffe zwar, dass das Problem gefixt wird
> aber den ViewHelper würde ich mir trotzdem gern ansehen.
>
> Grüße
> Alex
>
> Am 17. September 2011 19:38 schrieb Kay Strobach <typo3 at kay-strobach.de>:
>> Hi,
>>
>> ich habe nen Viewhelper der das können müsste was du willst ;)
>>
>> Interesse? - schick mir eine Mail.
>>
>> Grüße
>> Kay
>>
>> Am 17.09.2011 19:00, schrieb Alexander Walther:
>>> Hi Georg,
>>>
>>> okay wenn es ein Bug will ich nix gesagt habe. es kam nur so rüber als
>>> währ das Verhalten so gewollt.
>>>
>>> Grüße
>>> Alex
>>>
>>> Am 17. September 2011 18:43 schrieb Georg Ringer <typo3 at ringerge.org>:
>>>> Hi,
>>>>
>>>> das ganze nennt man halt ganz einfach bug. mach ein ticket auf und ich
>>>> bin mir sicher dass Sebastian schaut ob man das lösen kann.
>>>>
>>>> Ich stimme dir ja ohnedies zu dass es bugfreier besser ist
>>>>
>>>> Georg
>>>> _______________________________________________
>>>> TYPO3-german mailing list
>>>> TYPO3-german at lists.typo3.org
>>>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-german
>>>>
>>
>>
>> --
>> http://www.kay-strobach.de - Open Source Rocks
>>
>> TYPO3 .... inspiring people to share!
>> Get involved: http://typo3.org
>>
>> Answere was usefull: https://flattr.com/profile/kaystrobach
>> _______________________________________________
>> TYPO3-german mailing list
>> TYPO3-german at lists.typo3.org
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-german
>>
--
http://www.kay-strobach.de - Open Source Rocks
TYPO3 .... inspiring people to share!
Get involved: http://typo3.org
Answere was usefull: https://flattr.com/profile/kaystrobach
More information about the TYPO3-german
mailing list