On 29-01-2009 at 14:25:05 Werner wrote:
Modifiers and optional attributes don't mix - I'm sure it's a bug (I
seem to recall it working at some point, maybe about 2 years ago, but
I'm probably wrong). Consider this:
This is tricky, because:
a) all of the code after modifier is passed to function that handles it,
because modifiers can have their own syntax, eg. string: doesn't interpret |,
and php: makes it a binary operator.
b) function that generates modifier's code has to return single PHP expression,
and handling of alternatives is best done with PHP statements (some function
calls and if/else blocks are needed).
There's phptal_tale() function that implements alternatives using ternary
operator. You can use it in your modifier to support expressions with
alternatives.
It would be nice to allow expression modifiers to declare their syntax or
participate in parsing of TALES expressions. I'm open to suggestions how to
implement that.
As a sidenote: Modifier chains are not supported, right?
They are supported, unless some modifier in the chain breaks it (modifiers have
to pass subexpressions to phptal_tales()/phptal_tale() functions).
--
regards, Kornel
___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal