[PHPTAL] Multiple conditions

2008-05-30 Thread Anton Andrievskij
Hi, guys.

How can I specify multiple conditions using AND logical operator and php:
for one of the parts?

I'm trying this but does not works:

tal:condition=exists: products AND php:count(products) == 0

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


Re: [PHPTAL] Multiple conditions

2008-05-30 Thread Anton Andrievskij
 PHPTAL rewrites code in php: expressions to use TAL variables, so it
will work fine.

Please can you explain a bit more about this? How it works?

On Fri, May 30, 2008 at 7:47 PM, Kornel Lesinski [EMAIL PROTECTED]
wrote:

 On Fri, 30 May 2008 17:36:34 +0100, Anton Andrievskij [EMAIL PROTECTED]
 wrote:

  1. But then php will check if real products variable exists but not
 tal-object's product property?


 PHPTAL rewrites code in php: expressions to use TAL variables, so it will
 work fine.

 php:isset(var) is equivalent to exists:var (but not in more complex case of
 exists:var/prop - then you're out of luck ;)

  2. Why it is bad idea to have some logical operands in PHPTAL then?


 It isn't. It's a bit of syntax that's missing from plain TAL.


 --
 regards, Kornel

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

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


Re: [PHPTAL] Multiple conditions

2008-05-30 Thread Kornel Lesinski
On Fri, 30 May 2008 17:59:58 +0100, Anton Andrievskij [EMAIL PROTECTED]  
wrote:



PHPTAL rewrites code in php: expressions to use TAL variables, so it

will work fine.

Please can you explain a bit more about this? How it works?


There's a simple PHP parser that modifies the code (see  
Php/Transformer.php).
Mostly variables get prefixed with $ctx-, so isset(var) becomes  
isset($ctx-var).


--
regards, Kornel

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


Re: [PHPTAL] Multiple conditions

2008-05-30 Thread Christoph Frick
On Fri, May 30, 2008 at 07:04:47PM +0300, Anton Andrievskij wrote:

 How can I specify multiple conditions using AND logical operator and php:
 for one of the parts?
 
 I'm trying this but does not works:
 
 tal:condition=exists: products AND php:count(products) == 0

in python an empty list is also false. iirc phptal works in the same
way. so maybe you are better of by setting products all the time - even
if the list is empty - and then just tal:condition=products?

-- 
cu


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