I've noticed that PHPTal places the repeat value variable in the ctx
 object, which happens to be the same scope as all others
assigned to view. This presents a problem when using general
names through out your template, here is an example.

With in side phptal lets say you have two arrays, $user and $users.

<span tal:contents="user/firstName"/>

User list:
<select name="user" >
        <option tal:repeat="user users" tal:attributes="value user/ID"
        tal:content="user/firstName"/>
</select>

<span tal:contents="user/firstName"/>
Because of scoping issue, the original user will have been replaced
with the last user from repeat.


I'm not sure if this is a bug or not considering standard php practice
is to make these variables non local scope. I do feel in PHPTal that a
repeat should have it's own local scope, at least for it's variable.

What is the opinion on this?

My present work around is to check for the existence of an existing
property in ctx and make a backup, on ending of the repeat I then
copy the backup to the existing variable.


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

Reply via email to