Is it possible to set a template variable in a helper?
Ultimately what I'm trying to do is have a helper add in code to the header of the layout, for use with javascript and such.
Ways I can think of that I'd prefer not to use:
- Passing in the view object: don't want to worry about having to call an extra function
- using the "global" keyword to get the view, I really like to avoid using this except as a last resort since it's not considered orthodox
Any thoughts?
Update 2012-02-20: As cake as been updated more recently I've tried to include answers to Cake 1.2 as well as Cake 2. Thanks to Adam and mark for their recommendations