Re: [PHPTAL] Use of ${} vs tal attributes

2009-12-09 Thread Peter Niederlag
Hello Kornel,

Kornel Lesiński schrieb:
> On 08-12-2009 at 21:05:20 Tjerk Meesters  wrote:
> 
>> 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.
> 
> No, that was a bug I've fixed 8 months ago. Your PHPTAL is out of date :)


Big Thx for clarification! :->

${} just seems easier for me quite some times.

Greets,
Peter

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


Re: [PHPTAL] Use of ${} vs tal attributes

2009-12-09 Thread Kornel Lesiński

On 08-12-2009 at 21:05:20 Tjerk Meesters  wrote:


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.


No, that was a bug I've fixed 8 months ago. Your PHPTAL is out of date :)


--
regards, Kornel

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


Re: [PHPTAL] Use of ${} vs tal attributes

2009-12-08 Thread Tjerk Meesters
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  wrote:
> On 08-12-2009 at 15:55:37 Bas  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,
>>
>> ${myContent}
>>
>> is the same as
>>
>> 
>>
>> 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 (). 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


Re: [PHPTAL] Use of ${} vs tal attributes

2009-12-08 Thread Kornel Lesiński

On 08-12-2009 at 15:55:37 Bas  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,


${myContent}

is the same as



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 (). 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