Ticket Details

Option to disable extract()'ing of template variables

RFC Ticket (closed)

Since some people prefer more explicit access to variables, this ticket considers the possibility of the template renderer implementing `ArrayAccess`, such that variables accessed in templates as `$foo` would also be accessible as `$this['foo']`.  Furthermore, an option could be added to `render()` to disable calling `extract()` on template variables.

Please comment on proposed syntax/options/implementations.
on 02.15.10 reported by: nate owned by: nate

Updates

on 02.15.10 by ramsey
For portability, $this['foo'] should always work, even if the option to allow extract() is turned on. (I'm sure this is implicit here, but I'm making it explicit.)
on 02.15.10 by scoates
ArrayAccess was my idea, so I'm definitely +1 for it.
I don't mind the optional extract() (though I'd always use the explicit mode when possible).

S
(fixed) on 04.17.10 by nate
  • status was changed to closed
  • resolution was changed to fixed
Fixed in [c131c1e0af2e86af093aca51deeb20a14c6caddc].