Hello list,

I've modified the tal:condition attribute to handle chained
expressions so it can do stuff like "cart/items | nothing" or even
"showItems | cart/items | nothing".

I'm attaching the whole modified file since the almost all lines have changed.

I've also noticed that phptal_isempty() returns true only for Null,
False and zero length strings. However I feel that it should also
check for empty arrays. I do agree though that a int/float of value 0
should not be considered empty.
I propose the following patch to implement the empty array check.

Index: Context.php
===================================================================
--- Context.php (revision 331)
+++ Context.php (working copy)
@@ -374,7 +374,7 @@

 function phptal_isempty($var)
 {
-       return $var === null || $var === false || $var === '';
+       return $var === null || $var === false || $var === '' || (
is_array($var) && count($var)===0 );
 }

 function phptal_escape($var, $ent, $encoding)

Attachment: Condition.php
Description: Binary data

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

Reply via email to