In agreement with some of you, I also don't like having php expressions in my TAL templates.

I was wondering if some "arguments" as an extension to modifiers cannot be done in a way that simply introduces a new separator to the existing syntax, e.g. just as tal expressions already makes use of the semi-colon separator.

E.g. let's say we consider a comma separator for modifier "arguments", as the comma is a classic argument separator in many programming languages:

<element tal:attributes="attribute1 modifier:argument/1,argument/2; attribute2 modifier:argument/1,argument/2"></element>

Given this, one can speculate about a more leal-life example, which even a new TAL user would easily be able to pick up:

<option tal:attributes="selected compare:item/value,saved/value" tal:content="item/value"></option>


Just my 2 cents ;)



Kornel Lesiński wrote:

There are few cases where simple TALES (expressions like "foo/bar/baz") isn't working well, most often comparison of selected <option>, PHPTAL's pythonified/xmlized PHP syntax has gotchas and it's confusing to jump between the two.

I think in that case best solution would be to make TALES more powerful, but I wonder how much powerful? Should I add math expressions? String concatenation? Should I allow passing of function arguments? What the syntax should be like?

foo/bar EQ baz/quz

foo/bar + baz/quz

Should modifiers work inside TALES?

How do you mark end of modifier's content?

foo/bar + php:foo()

php:foo() + bar/baz

http://phptal.org/wiki/doku.php/improvedtales




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

Reply via email to