Hi,

why are "value" variables of loops (e.g. tal:repeat) set in the global scope 
($ctx)?

Yesterday I run into an error, because a template variable I set, got 
overwritten in a repeat loop in a template, because the "value" variable had 
the 
same name:

PHP:
====
[...]
$page = array(
    'title' => 'My page'
);

$subPages = getSubPages(); // returns an object

$tpl->set('page', $page);
$tpl->set('subPages', $subPages;
[...]

Template:
=========
[...]
<p tal:repeat="page subPages" tal:content="page/my/value" />
               ^^^^
                 |- This is what I call "value" variable
[...]
<span tal:content="page/title" />
[...]


...the last line will throw an error, because "page" is the last item of 
"subPages" and not my defined array.

Wouldn't it be better, if PHPTAL defines its own "value" variable (and also 
unset the variable after the loop, as the PHP documentation recommends)?


-- 
Regards,
Igor



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

Reply via email to