Well, you should test it out, but from what I can see in the source code the controller's view is rendered first and then passed on to the layout $content_for_layout.
During this process it merges $this->viewVars , so I would presume that every information you made available for the controller's view will also be available for the layout. If this works, then I would suggest to add your layout data to the view inside the beforeFilter() method of AppController and then use this data in your layout. Might even consider creating an element for the part that uses this data ... Friendly greetings, Bert On Fri, Oct 2, 2009 at 12:14 AM, Miles J <[email protected]> wrote: > > Just put <?php echo $content_for_layout; ?> in your layout file, and > then Cake will render your controllers view within that variables > location. > > On Oct 1, 3:05 pm, hahmadi82 <[email protected]> wrote: > > Correct, I want to use stuff from my cars controller in the > > views/layout/default.ctp. The only possible solution I can think is to > use > > ajax to load some of the car stuff. Basically, I'm curious how you can > > access your database from the layout file. > > > > > > > > Miles J wrote: > > > > > Im sorry but I dont understand what you are asking. > > > > > Layout toolbar? Controller class? Do you mean component? > > > > > Layout has no controller? Not sure what you mean there. > > > > > Database in layout? You mean your result right? > > > > > On Oct 1, 1:52 pm, hahmadi82 <[email protected]> wrote: > > >> Hi, > > > > >> I built a class with controller/views that I want displayed in my > layout > > >> toolbar. Is this possible? How can I use this queried data in my > layout > > >> file? Since layout has no controller, I'm not sure how I can use any > > >> database stuff in the layout.... > > >> -- > > >> View this message in > > >> context: > http://www.nabble.com/Access-Classes-In-Layout-Help---tp25706283p2570... > > >> Sent from the CakePHP mailing list archive at Nabble.com. > > > > -- > > View this message in context: > http://www.nabble.com/Access-Classes-In-Layout-Help---tp25706283p2570... > > Sent from the CakePHP mailing list archive at Nabble.com. > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
