On 08-12-2009 at 15:55:37 Bas <kooy...@hotmail.com> wrote:
I'm new to PHPTal and was wondering if the use of the ${} notation was
generally discouraged. It seems you can use this construct instead of
many of the PHPTal attributes. For example,
<p class="${myClass}">${myContent}</p>
is the same as
<p tal:attributes="class myClass" tal:content="myContent"></p>
Intuitively I would say the second method is the preferred way of doing
this in PHPTal, even though it is more verbose. Am I correct in thinking
this, and if so, why? Are there any advantages to using one method over
the other?
It's not discouraged. It's just less powerful, and depending on one's
taste for XML, uglier.
tal:content allows you to add example or default content. You can also use
self-closing tag notation with it (<div tal:content=""/>). If you don't
care about those features, you can use ${}.
tal:attributes allow you to remove attribute completely if value is NULL
or doesn't exist ("class myClass | nothing"). ${} in attribute will give
you empty string (class="").
--
regards, Kornel
_______________________________________________
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal