Hi,

I am new to PHPTal.

What I want:
I read a UNIX timestamp from my database and want to display it in a special 
format (o-m-d H:i:s, date() syntax).

This is how my template looks like:
[...]
<tr tal:repeat="item items">
        <td tal:content="item/id" />
        <td tal:content="item/name" />
        <td tal:content="item/date" />
</tr>
[...]

After reading the PHPTal documentation I would change it that way

        <td tal:content="myDate: item/date" />

and write a custom modifier like

function phptal_tales_myDate($src, $nothrow)
{
        $value = ???
        $result = date('o-m-d H:i:s', $value);
        return '"' . $result . '"';
}

And that's my problem. I don't know how to access the value of "item/date" 
within my custom modifier.

It would be simpler to just call a PHP function, but in your documentation you  
recommend to write a modifier...


-- 
Regards,
Igor




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

Reply via email to