I am still confused about why you want to have something in the
layout, that changes depending on the view!
If the view knows what to present, why does it have to inform layout
about it! The view just invokes the correct element to present.
It sounds to me that you are making it too complicated - try to
simplify it!

Mayby you can explain more about why you have made the decision to
implement it that way, maybe with an example and code?
Enjoy,
   John

On Apr 8, 11:47 am, the_woodsman <elwood.ca...@gmail.com> wrote:
> 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 <bally.z...@gmail.com> wrote:
>
> > On Tue, Apr 7, 2009 at 4:07 PM, the_woodsman <elwood.ca...@gmail.com> 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 cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to