[PHPTAL] omit-tag or ${}?

2008-11-19 Thread Szymek

Hi!

Which method of inserting a single variable into same element is better:

spanx tal:omit-tag= tal:content=price €/span

or

span${price} €/span
?
Evidently second method is much shorter, but which is more productivity 
(which is easier for PHPTAL to parse)?



cheers,
szymek



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


Re: [PHPTAL] omit-tag or ${}?

2008-11-19 Thread Christoph Frick
On Wed, Nov 19, 2008 at 11:11:37AM +0100, Szymek wrote:

 Which method of inserting a single variable into same element is better:

 spanx tal:omit-tag= tal:content=price ???/span

 or

 span${price} ???/span
 ?
 Evidently second method is much shorter, but which is more productivity 
 (which is easier for PHPTAL to parse)?

or

span tal:replace=price/price//span

or

span tal:content=price/price//span

-- 
cu


pgpCf6Y8xG2Ya.pgp
Description: PGP signature
___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] omit-tag or ${}?

2008-11-19 Thread Christoph Frick
On Wed, Nov 19, 2008 at 11:58:02AM +0100, Szymek Przyby? wrote:

 How works this expression: 'price | defaultPrice | nothing' (I don't
 saw something like this in manual)?

it evaluates like a logical or in php. is there price? use it - if not
is there defaultPrice? use it - if not use nothing. be sure to also
check ``something | default`` and the ``exists:`` stuff in the doku.

 And how difference is between replace and content expression?

see Kornels other mail

-- 
cu


pgpTF8U6Vc1bR.pgp
Description: PGP signature
___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


[PHPTAL] omit-tag or ${}?

2008-11-19 Thread Szymek Przybył

How works this expression: 'price | defaultPrice | nothing' (I don't saw 
something like this in manual)?

And how difference is between replace and content expression?


cheers,
szymek


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


[PHPTAL] omit-tag or ${}?

2008-11-19 Thread Szymek Przybył

What difference is between replace and content?

In my example I want to add after price variable EURO sign. But maybe 
better way to do it is just add to price variable this sign in PHP, 
before sending it to phptal template:

?php $price.=' euro;'
$main-price=$price;?

And better is to use entities (euro;) or entites after parse (EUR) in 
php/tamplates?



cheers,
szymek


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


Re: [PHPTAL] omit-tag or ${}?

2008-11-19 Thread Kornel Lesiński

On 19-11-2008 at 10:38:49 Szymek Przybył [EMAIL PROTECTED] wrote:


What difference is between replace and content?


Replace always replaces entire tag. It's a shortcut for tal:omit-tag and  
tal:content at once.


In my example I want to add after price variable EURO sign. But maybe  
better way to do it is just add to price variable this sign in PHP,  
before sending it to phptal template:

?php $price.=' euro;'
$main-price=$price;?


If you use entity, then price string becomes HTML. To protect against XSS  
vulnerabilities PHPTAL deliberately makes outputting of raw HTML harder.


If you use literal character (in appropriate encoding, I stronly suggest  
UTF-8), it will work fine. It's a good idea to keep price and currency  
together (you could get in trouble if someone changed currency in the  
template without changing prices accordingly).


And better is to use entities (euro;) or entites after parse (EUR) in  
php/tamplates?


It's better to use Unicode and produce standalone XML documents. That is  
never use entities except the basic XML ones (lt;, amp; and quot;).


--
regards, Kornel

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