Hmm we've seen this mistake being made a lot ;-) would it help if this
was documented under, like, "things to consider when using php:
modifier"? :)

On 6/18/09, Kornel Lesiński <kor...@aardvarkmedia.co.uk> wrote:
> On 18-06-2009 at 15:42:14 Igor Sverkos
> <igor.sverkos+php...@googlemail.com> wrote:
>
>> If you don't have an object, just an array - how do I access a simple
>> array key?
>
> With php: modifier you have to use [] for arrays, and . for objects.
>
>> Template:
>> =========
>> [...]
>> <tr tal:condition="exists: data" tal:repeat="item data">
>>     <td tal:content="item/name" />
>>     <td tal:content="php: view_Helper_getDate(item.date)" />
>> </tr>
>>
>>
>> The first td-row will work.
>>
>> The second row will throw a "Trying to get property of non-object..."
>> notice.
>
> Use item['date']
>
> item.date is only for objects, and will not work with arrays.
>
> --
> regards, Kornel
>
> _______________________________________________
> PHPTAL mailing list
> PHPTAL@lists.motion-twin.com
> http://lists.motion-twin.com/mailman/listinfo/phptal
>


-- 
--
Tjerk

_______________________________________________
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal

Reply via email to