Re: [PHPTAL] tal:repeat and php:

2009-05-26 Thread Kornel Lesiński
On 26-05-2009 at 13:22:10 Dominique Sandoz j...@gmx.ch wrote:

 Hi Tjerk,

 thank you very much! Worked like a charm :)

 Do you know if its possible to use repeat/box/number like
 tal:condition=php: repeat/box/number GT 3 ?

Yes. Use repeat.box.number (with php: expressions '.' means '-' and like GT 
it's another way to avoid unescaped '' in XML).

When you use php: expressions, PHPTAL won't guess types of 
variables/expressions for you, so you have to use array/object syntax where 
appropriate.

-- 
regards, Kornel

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


Re: [PHPTAL] tal:repeat and php:

2009-05-24 Thread Tjerk Meesters
That's because you're using the php: construct; try
tal:condition=php: box['nr']  5

Though, usually - wherever I can - i insert the condition inside the
list of elements I'm iterating over, so that I don't have to use php:


Best,
  Tjerk

On Sun, May 24, 2009 at 6:13 PM, Dominique Sandoz j...@gmx.ch wrote:
 Hello all,

 I'm searching/experimenting since hours, but I finally end up with nothing.

 I'm trying to use tal:repeat-Variables inside a php:-Condition, but
 everytime I do so, I got an error, that the variable is not defined.

 Here's my PHP-Array:
 ---
 $storeBoxes = array(
 array('nr'=3, 'name'='foo')
 );
 ---

 And my phptal:
 ---
    ul class=storeBoxes
        li tal:repeat=box storeBoxes class=storeBox
            strong tal:condition=php:${box/nr}  5
 tal:content=string:${box/name} ${repeat/box/number}
             gewählte Box #
            /strong
        /li
    /ul
 ---

 But all I get is, that nr is not defined (i tried to output it with
 tal:content and it worked...

 Can anyone help?

 greetings
 dominique

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




-- 
--
Tjerk

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