On 11-09-2009 at 14:07:54 Ionut Matei <johnu...@gmail.com> wrote:


How can I do in phptal something similar to
<?php echo nl2br(htmlspecialchars($variable)); ?>

I think something like
<div tal:content="structure php: nl2br(htmlspecialchars(variable))" />
will do it, but I'd not prefer to escape manually.

You can write your TALES modifier:

function phptal_tales_toHTML($src, $nothrow)
        return 'nl2br(htmlspecialchars(' . phptal_tales($src, $nothrow) . '))';

and then use shorter code:

${structure toHTML:variable}

Currently there's no way to get rid of 'structure' keyword in this situation.

regards, Kornel

PHPTAL mailing list

Reply via email to