Hello all you PHPTalians,

I'm attempting to create an 'abbrev' custom PHPTAL modifier. It would, if
the value is over a certain length, output it wrapped in an <abbrev> tag,
with the value appended by '...'. I intended to use it like this:

<span tal:content="abbrev: /some/path" />

To this end I devised this function:

function phptal_tales_abbrev( $src, $nothrow ) {
 return 'elided_html('.phptal_tales(' structure ' . $src,

where elided_html does the magic. However, this generates an error:

PHPTAL Exception

*Invalid TALES path: 'structure /some/path', expected 'structure
/some/path' to be variable name*
Is there something simple I'm missing? I understand I *could* do:

<span tal:content="structure abbrev: /some/path" />

and change the function accordingly, which isn't really that bad, but I'm
curious as to if my original idea should work?


PHPTAL mailing list

Reply via email to