Also, errors will be silently ignored by default if you use ${}.
Changing it to tal:content, for instance, without an alternative
(using pipe syntax) would throw a template exception if the used
expression could not be resolved at runtime.

On 12/9/09, Kornel Lesiński <kor...@aardvarkmedia.co.uk> wrote:
> 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
>


-- 
--
Tjerk

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

Reply via email to