Home » HTML » HTML_Template_Flexy » Bug #60
varname error (and limitation)
Details
| Submitted | 2003-10-04 13:42 UTC |
|---|---|
| From | jeroen at zwolnet dot com |
| Assigned | alan_k |
| Status | Closed |
| Package | HTML_Template_Flexy |
| PHP Version | Irrelevant |
| OS | Linux |
| Roadmaps | (Not assigned) |
Comments
[2003-10-04 13:42 UTC] jeroen at zwolnet dot com
Description:
------------
See code and workaround (explains it all :)
1. (this might be by design): it looks like vars are not allowed to start with a underscore. So eg. 'p._child' in exampple is not allowed.
2. (more serious): using a var in the parameterlist seems to loose the last character. In the workaround adding a 'x' after the var name 'p1' generates the correct code.
Reproduce code:
---------------
Template source:
DOES NOT WORK:
{foreach:p._child,n1,p1}
...
<a href="{t.url(p1)}">{p1.title}</a>
WORKAROUND:
{foreach:p.treeChild,n1,p1}
...
<a href="{t.url(p1x)}">{p1.title}</a>
[2003-10-04 15:35 UTC] jeroen at zwolnet dot com
> and I've not come up with any good reason _yet_ for changing it.. :)
One reason might be so you can use Flexy as a renderer for QuickFormController (without hacking around) .. :)
It makes buttons that start with '_qf_'.
The problem is that starting with a underscore does not always mean 'private', but is also used for namespace reasons ...
Greetings,
Jeroen.
[2004-04-03 21:28 UTC] info at rhalff dot com
I was just about to report the same bug. I'm trying to pass a PEAR_Pager object to Flexy containing an object list of pager data.
My first try was without the pager.
Data:
stdClass Object
(
[items] => Array
(
[0] => RHALFF_App_Poems_Data_Stories Object
(
etc..
I can loop through it in flexy like:
{foreach:items,item}
I decided passing it to Pager_Sliding would be nice, but I would need something like:
{foreach:t.getPageData(),items,item}
Flexy didn't understand this syntax so I tried to access the
property of Pager_Sliding directly, in this case it is _itemData, as the above post explains this isn't permitted.
The bug in this case is, that I have a valid object but cannot access it from Flexy, which could be fixed by adding a new feature that allows methods to be called from within a foreach loop.
Btw, A good reason to allow the underscore again would be that using '_' for marking private properties will be obsolete when PHP5 is used AND to make Jeroen happy offcourse ;)