Thanks for all your suggestions everyone.
So if Cake doesn't have a cleaner way to do this, how would I make one
myself?
The ideal would be to mimic the way vars are passed into views from
controllers, i.e in the view, setForLayout('varName', $varValue), and
then $varName just appears in the layout.
If i had ot use a method in the layout, like $varName = fromView
('varName'), that wouldn't be too bad either.
But how/where would this best be done, without hacking the core?
On Apr 8, 12:49 am, brian <[email protected]> wrote:
> On Tue, Apr 7, 2009 at 4:07 PM, the_woodsman <[email protected]> wrote:
>
> > Thanks Brian - but I don't understand how this addresses the issue...
>
> > Are you saying I can render the element twice, without bothering with
> > an if statement, and it will only get echo'd once?
>
> Sorry, I wrote it twice to point out that it can be used either way.
> Not both at once ;-)
>
> > And the real question - how do I get the value 'foo' into the layout
> > from the view!? $this->viewVars is how I'm doing it currently...
>
> Right, I was thinking that the element would be included in the
> layout, not the view. But, of course, passing the var to the element
> will only work if called in the view.
>
> Looks like $viewVars is the way to proceed.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---