Hello :)

It wouldn't work quite as you suggest because of how you use tales but we have 
an 'equal' tale as part of Ztal that does pretty much the same thing. You use 
it as follows:

<div tal:condition="Ztal_Tales_Generic.equal:listing.status,string:ACTIVE" 
>print some good content here</div>

The | symbol can be considered an 'or' where if the first statement fails or 
returns false the next statement is attempted and so on. The Ztal equal tale 
does support chaining in this way. However, there is no 'built-in' support for 
'and' - generally you just need to put a second condition block within the 
first:

<tal:block 
tal:condition="Ztal_Tales_Generic.equal:listing/status,string:ACTIVE" >
        <div 
tal:condition="Ztal_Tales_Generic.equal:listing/type,string:PREMIER" >
                print some good content here
        </div>
</tal:block>

Obviously the tales packaged as part of Ztal are completely useable without 
needing to use the rest of Ztal :)

Robert

On 13 Apr 2011, at 14:45, Ciprian Voicu wrote:

> I've encountered lots of times the need to compare one or more pairs of 
> values so I used php: modifier, but let's say would be more professional 
> using some internal tal way instead of php native comparison way.
> 
> eg: 
> 
> <div tal:condition="php: listing.status == 'ACTIVE' && listing.type == 
> 'PREMIER'">print some good content here</div>
> 
> it will be something more likely to use:
> 
> <div tal:equal="listing/status 'ACTIVE'; listing/type 'PREMIER'">print some 
> good content here</div>
> 
> 
> 
> Another question. 
> I use pipe (`|`) also in tal:condition to check if at least one of the 
> expressions is true, but what if we would have some way to check if all 
> conditional expressions are true?
> 
> Did I understood wrong some PHPTal principles having these requests?
> 
> Ciprian Voicu
> 
> 
> 
> -- 
> 
>       Ciprian Voicu 
> Modernism.RO
> 
> 
> 
> _______________________________________________
> 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

Reply via email to