Hi,

If you don't have an object, just an array - how do I access a simple array 
key? 
In TAL, i would just write "array/key", but with modifier, it won't work.

For example:

PHP:
====
[...]
$data = array();
foreach ($db->fetchRow() as $row){
    $item = array(
        'name' => $row['name'],
        'date' => $row['date']
        [...]
    );

    $data[] = $item;
}

$tpl->set('data', $data);


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.


-- 
Regards,
Igor



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

Reply via email to