Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.3.9

Request #6212 can't use foreach with a method call
Submitted: 2005-12-09 12:20 UTC Modified: 2005-12-11 23:36 UTC
From: koeglstefan at gmx dot at Assigned:
Status: Verified Package: HTML_Template_Flexy
PHP Version: 5.0.5 OS: Gentoo Linux
Roadmaps: (Not assigned)    
Subscription  
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes. If this is not your bug, you can add a comment by following this link. If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: koeglstefan at gmx dot at
New email:
PHP Version: Package Version: OS:

 

 [2005-12-09 12:20 UTC] koeglstefan at gmx dot at
Description: ------------ Using a foreach-loop with a method call which returns a array in the form {foreach:object.method(),var} returns the following error Parse error: parse error, unexpected '}' in /tmp/flexy_compiled_templates/<path>/info.html.en.php on line 18 Test script: --------------- {foreach:object.method(),var} {do_something()} {end:}

Comments

 [2005-12-11 23:35 UTC] alan_k
it's not supported, I dont think any of the documentation hints that it might be. - It's trivial to work around - If you want to create a patch to fix, feel free to send me it. Leaving as an open Feature Request
 [2005-12-14 17:18 UTC] mkliewe at gmx dot de
Would be nice if it will be added. I know the documentation only says that there should be a variable, but in the construct <tr flexy:foreach="object.getMethod(),m"> <td></td> </tr> the documentation also says there should be a variable, but in that case the method-call is working. So it cannot be too hard to get a method-call in a "normal" foreach-loop working.
 [2006-06-22 04:33 UTC] jan at motubo dot com (jan)
i agree with stefan, its annoying to can't use method calls within {foreach...}. tried to patch this - the tokenizer does the parsing, right? its nearly impossible to patch this "cryptic" code for anyone who has not wrote this class. but: as stefan wrote, <tr flexy:foreach="object.getMethod(),m"> works with methods. Is this a bug which will be fixed soon or will this stay a feature so we can use this...???
 [2008-04-06 16:48 UTC] silvan (Silvan Thus)
flexy:foreach="object.getMethod(),m" : works flexy:foreach="object.getMethod(singleParameter),m" : also works flexy:foreach="object.getMethod(parameterOne,parameterTwo),m" : does NOT work the tokenizer chokes on the ','