For the and operation I've written a modifier that turns all its arguments
into an array of booleans and then uses array_mult() to determine the
outcome for tal:condition.

array_sum could be used for the or-operation ;)
On Apr 14, 2011 2:27 AM, "Kornel Lesiński" <kor...@geekhood.net> wrote:
> On Wed, 13 Apr 2011 14:45:31 +0100, Ciprian Voicu <pict...@autoportret.ro>

> 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>
>
> You could have method like isActivePremier() [or whatever name better
> describes state you're checking for] and use it like this:
>
> <div tal:condition="listing/isActivePremier">
>
> If the condition is related to your business rules, then I think that's
> the most appropriate way to do it.
>
> --
> regards, Kornel Lesiński
>
> _______________________________________________
> 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