Re: [PHPTAL] tal:equal ?!

2011-04-14 Thread Ciprian Voicu
Thanks for the answer.

I didn't use Ztal until now, even if I've proposed to myself to do it. But
in the next project I will be involved it is sure I will do it. I followed
the discussions about Ztal and seems to me quite intuitive, at least for me.
Anyway, I like very much the pair PHPTal and Zend Framework made.

I agree also for the native PHPTal way, only that I thought of a shorter way
of doing the same thing.


Thanks again,
Ciprian




On Wed, Apr 13, 2011 at 5:04 PM, Robert Goldsmith wrote:

> 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:
>
>  >print some good content here
>
> 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:condition="Ztal_Tales_Generic.equal:listing/status,string:ACTIVE" >
> tal:condition="Ztal_Tales_Generic.equal:listing/type,string:PREMIER" >
> print some good content here
>
> 
>
> 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:
> >
> > print some good content here
> >
> > it will be something more likely to use:
> >
> > print
> some good content here
> >
> >
> >
> > 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
>
___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] tal:equal ?!

2011-04-13 Thread Tjerk Meesters
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"  wrote:
> On Wed, 13 Apr 2011 14:45:31 +0100, 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:
>>
>> print some good content here
>
> You could have method like isActivePremier() [or whatever name better
> describes state you're checking for] and use it like this:
>
> 
>
> 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


Re: [PHPTAL] tal:equal ?!

2011-04-13 Thread Kornel Lesiński
On Wed, 13 Apr 2011 14:45:31 +0100, 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:

print some good content here


You could have method like isActivePremier() [or whatever name better  
describes state you're checking for] and use it like this:




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


Re: [PHPTAL] tal:equal ?!

2011-04-13 Thread Robert Goldsmith
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:

print some good content here

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:



print some good content here



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: 
> 
> print some good content here
> 
> it will be something more likely to use:
> 
> print some 
> good content here
> 
> 
> 
> 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


[PHPTAL] tal:equal ?!

2011-04-13 Thread Ciprian Voicu
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:

print some good content here

it will be something more likely to use:

print some
good content here



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