Re: Access Classes In Layout Help??

2009-10-05 Thread Bert Van den Brande
;>> wrote:
> >>>> >
> >>>> > >> Ok so I actually didn't create a layout for each view from my
> >>>> > >> controllers.
> >>>> > >> Instead, all the views use the same layout, which is the
> >>>> default.ctp.
> >>>> Is
> >>>> > >> that incorrect? From my understanding, the default layout is
> >>>> loaded
> >>>> by
> >>>> > >> every
> >>>> > >> view and that's why I have my navigation bar in it.  It seems
> that
> >>>> I
> >>>> can
> >>>> > >> only access those "set" variables from something like
> >>>> > >> views/layouts/cars/index.ctp but not views/layouts/default.ctp.
> Is
> >>>> there
> >>>> > >> a
> >>>> > >> difference between the model layouts and the default layout?
> >>>> >
> >>>> > > You *almost* have it. Once again:
> >>>> >
> >>>> > > When a controller's action is run, its render() method is called
> >>>> > > automatically (yes, you can call it yourself but please ignore
> that
> >>>> > > for now). When that happens, Cake will use the View class to
> render
> >>>> > > the view template for that action. These templates are in
> >>>> > > app/views/controller_name_ending_in_s/action_name.ctp
> >>>> >
> >>>> > > Usually, the view template contains some HTML that you have
> >>>> included,
> >>>> > > along with some variables. Those variables are passed to the View
> >>>> > > class through the controller's $viewVars class variable. When you
> >>>> call
> >>>> > > $this->set('foo', 'bar'), you are passing the value, 'bar' to the
> >>>> > > controller's $viewVars array with a key, 'foo'.
> >>>> >
> >>>> > > When the controller's $viewVars is handed off to the View class,
> it
> >>>> > > extracts them, essentially creating a var named $foo that contains
> >>>> the
> >>>> > > value 'bar'.
> >>>> >
> >>>> > > Now, after the View has finished using the view template to render
> >>>> > > something to output it creates a variable called,
> >>>> $content_for_layout.
> >>>> >
> >>>> > > It then renders the layout template. That's a file in
> >>>> > > app/views/layout/name_of_your_layout.ctp. If you don't specify a
> >>>> > > layout, Cake uses 'default'.
> >>>> >
> >>>> > > Inside the layout template is (should be) a variable named ...
> >>>> > > $content_for_layout. This is where the contents of your rendered
> >>>> view
> >>>> > > are written to the layout.
> >>>> >
> >>>> > > So, try this: In one of your controller actions, add
> >>>> $this->set('foo',
> >>>> > > 'bar');
> >>>> >
> >>>> > > In your app/views/layouts/default.ctp add this, just above
> >>>> > > $content_for_layout
> >>>> >
> >>>> > > echo $foo;
> >>>> >
> >>>> > > You should see 'bar' in there, somewhere. View source and search
> >>>> for
> >>>> > > it, because your CSS may hide it.
> >>>> >
> >>>> > > Anyway, perhaps you should post the relevant part of your layout
> >>>> file
> >>>> > > and the controller action.
> >>>> >
> >>>> > --
> >>>> > View this message in context:
> >>>>
> http://www.nabble.com/Access-Classes-In-Layout-Help---tp25706283p2572...
> >>>> > Sent from the CakePHP mailing list archive at Nabble.com.
> >>>> >
> >>>>
> >>>
> >>> >
> >>>
> >>>
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/Access-Classes-In-Layout-Help---tp25706283p25731765.html
> >> Sent from the CakePHP mailing list archive at Nabble.com.
> >>
> >>
> >> >
> >>
> >
> > >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Access-Classes-In-Layout-Help---tp25706283p25757183.html
> 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 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
-~--~~~~--~~--~--~---



Re: Access Classes In Layout Help??

2009-10-05 Thread hahmadi82
ot views/layouts/default.ctp. Is
>>>> there
>>>> > >> a
>>>> > >> difference between the model layouts and the default layout?
>>>> >
>>>> > > You *almost* have it. Once again:
>>>> >
>>>> > > When a controller's action is run, its render() method is called
>>>> > > automatically (yes, you can call it yourself but please ignore that
>>>> > > for now). When that happens, Cake will use the View class to render
>>>> > > the view template for that action. These templates are in
>>>> > > app/views/controller_name_ending_in_s/action_name.ctp
>>>> >
>>>> > > Usually, the view template contains some HTML that you have
>>>> included,
>>>> > > along with some variables. Those variables are passed to the View
>>>> > > class through the controller's $viewVars class variable. When you
>>>> call
>>>> > > $this->set('foo', 'bar'), you are passing the value, 'bar' to the
>>>> > > controller's $viewVars array with a key, 'foo'.
>>>> >
>>>> > > When the controller's $viewVars is handed off to the View class, it
>>>> > > extracts them, essentially creating a var named $foo that contains
>>>> the
>>>> > > value 'bar'.
>>>> >
>>>> > > Now, after the View has finished using the view template to render
>>>> > > something to output it creates a variable called,
>>>> $content_for_layout.
>>>> >
>>>> > > It then renders the layout template. That's a file in
>>>> > > app/views/layout/name_of_your_layout.ctp. If you don't specify a
>>>> > > layout, Cake uses 'default'.
>>>> >
>>>> > > Inside the layout template is (should be) a variable named ...
>>>> > > $content_for_layout. This is where the contents of your rendered
>>>> view
>>>> > > are written to the layout.
>>>> >
>>>> > > So, try this: In one of your controller actions, add
>>>> $this->set('foo',
>>>> > > 'bar');
>>>> >
>>>> > > In your app/views/layouts/default.ctp add this, just above
>>>> > > $content_for_layout
>>>> >
>>>> > > echo $foo;
>>>> >
>>>> > > You should see 'bar' in there, somewhere. View source and search
>>>> for
>>>> > > it, because your CSS may hide it.
>>>> >
>>>> > > Anyway, perhaps you should post the relevant part of your layout
>>>> file
>>>> > > and the controller action.
>>>> >
>>>> > --
>>>> > View this message in context:
>>>> http://www.nabble.com/Access-Classes-In-Layout-Help---tp25706283p2572...
>>>> > Sent from the CakePHP mailing list archive at Nabble.com.
>>>> >
>>>>
>>>
>>> >
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Access-Classes-In-Layout-Help---tp25706283p25731765.html
>> Sent from the CakePHP mailing list archive at Nabble.com.
>>
>>
>> >
>>
> 
> > 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Access-Classes-In-Layout-Help---tp25706283p25757183.html
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 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
-~--~~~~--~~--~--~---



Re: Access Classes In Layout Help??

2009-10-05 Thread hahmadi82
 model layouts and the default layout?
>>>> >
>>>> > > You *almost* have it. Once again:
>>>> >
>>>> > > When a controller's action is run, its render() method is called
>>>> > > automatically (yes, you can call it yourself but please ignore that
>>>> > > for now). When that happens, Cake will use the View class to render
>>>> > > the view template for that action. These templates are in
>>>> > > app/views/controller_name_ending_in_s/action_name.ctp
>>>> >
>>>> > > Usually, the view template contains some HTML that you have
>>>> included,
>>>> > > along with some variables. Those variables are passed to the View
>>>> > > class through the controller's $viewVars class variable. When you
>>>> call
>>>> > > $this->set('foo', 'bar'), you are passing the value, 'bar' to the
>>>> > > controller's $viewVars array with a key, 'foo'.
>>>> >
>>>> > > When the controller's $viewVars is handed off to the View class, it
>>>> > > extracts them, essentially creating a var named $foo that contains
>>>> the
>>>> > > value 'bar'.
>>>> >
>>>> > > Now, after the View has finished using the view template to render
>>>> > > something to output it creates a variable called,
>>>> $content_for_layout.
>>>> >
>>>> > > It then renders the layout template. That's a file in
>>>> > > app/views/layout/name_of_your_layout.ctp. If you don't specify a
>>>> > > layout, Cake uses 'default'.
>>>> >
>>>> > > Inside the layout template is (should be) a variable named ...
>>>> > > $content_for_layout. This is where the contents of your rendered
>>>> view
>>>> > > are written to the layout.
>>>> >
>>>> > > So, try this: In one of your controller actions, add
>>>> $this->set('foo',
>>>> > > 'bar');
>>>> >
>>>> > > In your app/views/layouts/default.ctp add this, just above
>>>> > > $content_for_layout
>>>> >
>>>> > > echo $foo;
>>>> >
>>>> > > You should see 'bar' in there, somewhere. View source and search
>>>> for
>>>> > > it, because your CSS may hide it.
>>>> >
>>>> > > Anyway, perhaps you should post the relevant part of your layout
>>>> file
>>>> > > and the controller action.
>>>> >
>>>> > --
>>>> > View this message in context:
>>>> http://www.nabble.com/Access-Classes-In-Layout-Help---tp25706283p2572...
>>>> > Sent from the CakePHP mailing list archive at Nabble.com.
>>>> >
>>>>
>>>
>>> >
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Access-Classes-In-Layout-Help---tp25706283p25731765.html
>> Sent from the CakePHP mailing list archive at Nabble.com.
>>
>>
>> >
>>
> 
> > 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Access-Classes-In-Layout-Help---tp25706283p25757010.html
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 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
-~--~~~~--~~--~--~---



Re: Access Classes In Layout Help??

2009-10-03 Thread brian
'bar'), you are passing the value, 'bar' to the
>>> > > controller's $viewVars array with a key, 'foo'.
>>> >
>>> > > When the controller's $viewVars is handed off to the View class, it
>>> > > extracts them, essentially creating a var named $foo that contains
>>> the
>>> > > value 'bar'.
>>> >
>>> > > Now, after the View has finished using the view template to render
>>> > > something to output it creates a variable called,
>>> $content_for_layout.
>>> >
>>> > > It then renders the layout template. That's a file in
>>> > > app/views/layout/name_of_your_layout.ctp. If you don't specify a
>>> > > layout, Cake uses 'default'.
>>> >
>>> > > Inside the layout template is (should be) a variable named ...
>>> > > $content_for_layout. This is where the contents of your rendered view
>>> > > are written to the layout.
>>> >
>>> > > So, try this: In one of your controller actions, add
>>> $this->set('foo',
>>> > > 'bar');
>>> >
>>> > > In your app/views/layouts/default.ctp add this, just above
>>> > > $content_for_layout
>>> >
>>> > > echo $foo;
>>> >
>>> > > You should see 'bar' in there, somewhere. View source and search for
>>> > > it, because your CSS may hide it.
>>> >
>>> > > Anyway, perhaps you should post the relevant part of your layout file
>>> > > and the controller action.
>>> >
>>> > --
>>> > View this message in context:
>>> http://www.nabble.com/Access-Classes-In-Layout-Help---tp25706283p2572...
>>> > Sent from the CakePHP mailing list archive at Nabble.com.
>>> >
>>>
>>
>> >
>>
>>
>
> --
> View this message in context: 
> http://www.nabble.com/Access-Classes-In-Layout-Help---tp25706283p25731765.html
> 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 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
-~--~~~~--~~--~--~---



Re: Access Classes In Layout Help??

2009-10-03 Thread hahmadi82


Yea, probably much easier for me to explain what I've done and what I'd like
to do.

So basically I implemented the ajax select box using the code below:

http://www.devmoz.com/blog/2007/04/04/cakephp-update-a-select-box-using-ajax/

My code set up is more less the same as the example posted in that article. 
The ajax select box I created allows a user to select a car make, then year,
then model.  Currently, I have this working in index.ctp just like the
example, and the ajax calls the update_select.ctp.

What I would like to do, is move this ajax selector into my navigation bar
so that the user can change is car at any point during his browsing
experience.  This means that no matter what view he's on, he can still use
my ajax selector through the navbar.

The complication is that my code is in my car_controller "index.ctp" and
uses "update_select.ctp" with observefield (like the example).  I want to
somehow move this code/functionality into my default.ctp.  Perhaps you guys
can suggest the best strategy?  Even if I move the code from index.ctp to
default and access the set variable from the app_controller before filter
(as suggested), I still have the issue of ajax having to call the
update_select function which I have no idea where I would move it to
(perhaps in the app_controller?)...

I apologize for the constant questions and greatly appreciate the help you
guys have been giving me :)  





And then we scroll back 15 emails :


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 ...


> 
> :)
> 
> On Sat, Oct 3, 2009 at 10:34 AM, Miles J  wrote:
> 
>>
>> Do it in the beforeFilter() of your AppController, that will apply it
>> to all views and layouts.
>>
>> On Oct 3, 1:18 am, hahmadi82  wrote:
>> > Now I see!  So the set variables change depending on which view is
>> showing
>> > within the default.ctp.  If I add this car action to the app_controller
>> > (instead of car model) and set the variables there, will all the views
>> have
>> > access to that variable? How can I make a global "set" variable that
>> comes
>> > from a specific query?
>> >
>> >
>> >
>> > brian-263 wrote:
>> >
>> > > On Fri, Oct 2, 2009 at 10:55 PM, hahmadi82 
>> wrote:
>> >
>> > >> Ok so I actually didn't create a layout for each view from my
>> > >> controllers.
>> > >> Instead, all the views use the same layout, which is the
>> default.ctp.
>> Is
>> > >> that incorrect? From my understanding, the default layout is loaded
>> by
>> > >> every
>> > >> view and that's why I have my navigation bar in it.  It seems that I
>> can
>> > >> only access those "set" variables from something like
>> > >> views/layouts/cars/index.ctp but not views/layouts/default.ctp. Is
>> there
>> > >> a
>> > >> difference between the model layouts and the default layout?
>> >
>> > > You *almost* have it. Once again:
>> >
>> > > When a controller's action is run, its render() method is called
>> > > automatically (yes, you can call it yourself but please ignore that
>> > > for now). When that happens, Cake will use the View class to render
>> > > the view template for that action. These templates are in
>> > > app/views/controller_name_ending_in_s/action_name.ctp
>> >
>> > > Usually, the view template contains some HTML that you have included,
>> > > along with some variables. Those variables are passed to the View
>> > > class through the controller's $viewVars class variable. When you
>> call
>> > > $this->set('foo', 'bar'), you are passing the value, 'bar' to the
>> > > controller's $viewVars array with a key, 'foo'.
>> >
>> > > When the controller's $viewVars is handed off to the View class, it
>> > > extracts them, essentially creating a var named $foo that contains
>> the
>> > > value 'bar'.
>> >
>> > > Now, after the View has finished using the view template to render
>> > > something to output it creates a variable called,
>> $content_for_layout.
>> >
>> > > It then renders the layout template. That's a file in
>> > > app/views/layout/name_of_your_layout.ctp. If you don'

Re: Access Classes In Layout Help??

2009-10-03 Thread Bert Van den Brande
And then we scroll back 15 emails :


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 ...


:)

On Sat, Oct 3, 2009 at 10:34 AM, Miles J  wrote:

>
> Do it in the beforeFilter() of your AppController, that will apply it
> to all views and layouts.
>
> On Oct 3, 1:18 am, hahmadi82  wrote:
> > Now I see!  So the set variables change depending on which view is
> showing
> > within the default.ctp.  If I add this car action to the app_controller
> > (instead of car model) and set the variables there, will all the views
> have
> > access to that variable? How can I make a global "set" variable that
> comes
> > from a specific query?
> >
> >
> >
> > brian-263 wrote:
> >
> > > On Fri, Oct 2, 2009 at 10:55 PM, hahmadi82 
> wrote:
> >
> > >> Ok so I actually didn't create a layout for each view from my
> > >> controllers.
> > >> Instead, all the views use the same layout, which is the default.ctp.
> Is
> > >> that incorrect? From my understanding, the default layout is loaded by
> > >> every
> > >> view and that's why I have my navigation bar in it.  It seems that I
> can
> > >> only access those "set" variables from something like
> > >> views/layouts/cars/index.ctp but not views/layouts/default.ctp. Is
> there
> > >> a
> > >> difference between the model layouts and the default layout?
> >
> > > You *almost* have it. Once again:
> >
> > > When a controller's action is run, its render() method is called
> > > automatically (yes, you can call it yourself but please ignore that
> > > for now). When that happens, Cake will use the View class to render
> > > the view template for that action. These templates are in
> > > app/views/controller_name_ending_in_s/action_name.ctp
> >
> > > Usually, the view template contains some HTML that you have included,
> > > along with some variables. Those variables are passed to the View
> > > class through the controller's $viewVars class variable. When you call
> > > $this->set('foo', 'bar'), you are passing the value, 'bar' to the
> > > controller's $viewVars array with a key, 'foo'.
> >
> > > When the controller's $viewVars is handed off to the View class, it
> > > extracts them, essentially creating a var named $foo that contains the
> > > value 'bar'.
> >
> > > Now, after the View has finished using the view template to render
> > > something to output it creates a variable called, $content_for_layout.
> >
> > > It then renders the layout template. That's a file in
> > > app/views/layout/name_of_your_layout.ctp. If you don't specify a
> > > layout, Cake uses 'default'.
> >
> > > Inside the layout template is (should be) a variable named ...
> > > $content_for_layout. This is where the contents of your rendered view
> > > are written to the layout.
> >
> > > So, try this: In one of your controller actions, add $this->set('foo',
> > > 'bar');
> >
> > > In your app/views/layouts/default.ctp add this, just above
> > > $content_for_layout
> >
> > > echo $foo;
> >
> > > You should see 'bar' in there, somewhere. View source and search for
> > > it, because your CSS may hide it.
> >
> > > Anyway, perhaps you should post the relevant part of your layout file
> > > and the controller action.
> >
> > --
> > View this message in context:
> http://www.nabble.com/Access-Classes-In-Layout-Help---tp25706283p2572...
> > 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 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
-~--~~~~--~~--~--~---



Re: Access Classes In Layout Help??

2009-10-03 Thread brian

On Sat, Oct 3, 2009 at 4:18 AM, hahmadi82  wrote:
>
>
> Now I see!  So the set variables change depending on which view is showing
> within the default.ctp.  If I add this car action to the app_controller
> (instead of car model) and set the variables there, will all the views have
> access to that variable? How can I make a global "set" variable that comes
> from a specific query?

I think you're still not quite seeing it. But I'm having some
difficulty understanding what it is you're trying to do. Maybe you
should post some code.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Access Classes In Layout Help??

2009-10-03 Thread Miles J

Do it in the beforeFilter() of your AppController, that will apply it
to all views and layouts.

On Oct 3, 1:18 am, hahmadi82  wrote:
> Now I see!  So the set variables change depending on which view is showing
> within the default.ctp.  If I add this car action to the app_controller
> (instead of car model) and set the variables there, will all the views have
> access to that variable? How can I make a global "set" variable that comes
> from a specific query?
>
>
>
> brian-263 wrote:
>
> > On Fri, Oct 2, 2009 at 10:55 PM, hahmadi82  wrote:
>
> >> Ok so I actually didn't create a layout for each view from my
> >> controllers.
> >> Instead, all the views use the same layout, which is the default.ctp. Is
> >> that incorrect? From my understanding, the default layout is loaded by
> >> every
> >> view and that's why I have my navigation bar in it.  It seems that I can
> >> only access those "set" variables from something like
> >> views/layouts/cars/index.ctp but not views/layouts/default.ctp. Is there
> >> a
> >> difference between the model layouts and the default layout?
>
> > You *almost* have it. Once again:
>
> > When a controller's action is run, its render() method is called
> > automatically (yes, you can call it yourself but please ignore that
> > for now). When that happens, Cake will use the View class to render
> > the view template for that action. These templates are in
> > app/views/controller_name_ending_in_s/action_name.ctp
>
> > Usually, the view template contains some HTML that you have included,
> > along with some variables. Those variables are passed to the View
> > class through the controller's $viewVars class variable. When you call
> > $this->set('foo', 'bar'), you are passing the value, 'bar' to the
> > controller's $viewVars array with a key, 'foo'.
>
> > When the controller's $viewVars is handed off to the View class, it
> > extracts them, essentially creating a var named $foo that contains the
> > value 'bar'.
>
> > Now, after the View has finished using the view template to render
> > something to output it creates a variable called, $content_for_layout.
>
> > It then renders the layout template. That's a file in
> > app/views/layout/name_of_your_layout.ctp. If you don't specify a
> > layout, Cake uses 'default'.
>
> > Inside the layout template is (should be) a variable named ...
> > $content_for_layout. This is where the contents of your rendered view
> > are written to the layout.
>
> > So, try this: In one of your controller actions, add $this->set('foo',
> > 'bar');
>
> > In your app/views/layouts/default.ctp add this, just above
> > $content_for_layout
>
> > echo $foo;
>
> > You should see 'bar' in there, somewhere. View source and search for
> > it, because your CSS may hide it.
>
> > Anyway, perhaps you should post the relevant part of your layout file
> > and the controller action.
>
> --
> View this message in 
> context:http://www.nabble.com/Access-Classes-In-Layout-Help---tp25706283p2572...
> 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 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
-~--~~~~--~~--~--~---



Re: Access Classes In Layout Help??

2009-10-03 Thread hahmadi82


Now I see!  So the set variables change depending on which view is showing
within the default.ctp.  If I add this car action to the app_controller
(instead of car model) and set the variables there, will all the views have
access to that variable? How can I make a global "set" variable that comes
from a specific query?

 

brian-263 wrote:
> 
> 
> On Fri, Oct 2, 2009 at 10:55 PM, hahmadi82  wrote:
>>
>>
>> Ok so I actually didn't create a layout for each view from my
>> controllers.
>> Instead, all the views use the same layout, which is the default.ctp. Is
>> that incorrect? From my understanding, the default layout is loaded by
>> every
>> view and that's why I have my navigation bar in it.  It seems that I can
>> only access those "set" variables from something like
>> views/layouts/cars/index.ctp but not views/layouts/default.ctp. Is there
>> a
>> difference between the model layouts and the default layout?
> 
> You *almost* have it. Once again:
> 
> When a controller's action is run, its render() method is called
> automatically (yes, you can call it yourself but please ignore that
> for now). When that happens, Cake will use the View class to render
> the view template for that action. These templates are in
> app/views/controller_name_ending_in_s/action_name.ctp
> 
> Usually, the view template contains some HTML that you have included,
> along with some variables. Those variables are passed to the View
> class through the controller's $viewVars class variable. When you call
> $this->set('foo', 'bar'), you are passing the value, 'bar' to the
> controller's $viewVars array with a key, 'foo'.
> 
> When the controller's $viewVars is handed off to the View class, it
> extracts them, essentially creating a var named $foo that contains the
> value 'bar'.
> 
> Now, after the View has finished using the view template to render
> something to output it creates a variable called, $content_for_layout.
> 
> It then renders the layout template. That's a file in
> app/views/layout/name_of_your_layout.ctp. If you don't specify a
> layout, Cake uses 'default'.
> 
> Inside the layout template is (should be) a variable named ...
> $content_for_layout. This is where the contents of your rendered view
> are written to the layout.
> 
> So, try this: In one of your controller actions, add $this->set('foo',
> 'bar');
> 
> In your app/views/layouts/default.ctp add this, just above
> $content_for_layout
> 
> echo $foo;
> 
> You should see 'bar' in there, somewhere. View source and search for
> it, because your CSS may hide it.
> 
> Anyway, perhaps you should post the relevant part of your layout file
> and the controller action.
> 
> > 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Access-Classes-In-Layout-Help---tp25706283p25726631.html
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 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
-~--~~~~--~~--~--~---



Re: Access Classes In Layout Help??

2009-10-02 Thread brian

On Fri, Oct 2, 2009 at 10:55 PM, hahmadi82  wrote:
>
>
> Ok so I actually didn't create a layout for each view from my controllers.
> Instead, all the views use the same layout, which is the default.ctp. Is
> that incorrect? From my understanding, the default layout is loaded by every
> view and that's why I have my navigation bar in it.  It seems that I can
> only access those "set" variables from something like
> views/layouts/cars/index.ctp but not views/layouts/default.ctp. Is there a
> difference between the model layouts and the default layout?

You *almost* have it. Once again:

When a controller's action is run, its render() method is called
automatically (yes, you can call it yourself but please ignore that
for now). When that happens, Cake will use the View class to render
the view template for that action. These templates are in
app/views/controller_name_ending_in_s/action_name.ctp

Usually, the view template contains some HTML that you have included,
along with some variables. Those variables are passed to the View
class through the controller's $viewVars class variable. When you call
$this->set('foo', 'bar'), you are passing the value, 'bar' to the
controller's $viewVars array with a key, 'foo'.

When the controller's $viewVars is handed off to the View class, it
extracts them, essentially creating a var named $foo that contains the
value 'bar'.

Now, after the View has finished using the view template to render
something to output it creates a variable called, $content_for_layout.

It then renders the layout template. That's a file in
app/views/layout/name_of_your_layout.ctp. If you don't specify a
layout, Cake uses 'default'.

Inside the layout template is (should be) a variable named ...
$content_for_layout. This is where the contents of your rendered view
are written to the layout.

So, try this: In one of your controller actions, add $this->set('foo', 'bar');

In your app/views/layouts/default.ctp add this, just above $content_for_layout

echo $foo;

You should see 'bar' in there, somewhere. View source and search for
it, because your CSS may hide it.

Anyway, perhaps you should post the relevant part of your layout file
and the controller action.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Access Classes In Layout Help??

2009-10-02 Thread hahmadi82


Ok so I actually didn't create a layout for each view from my controllers. 
Instead, all the views use the same layout, which is the default.ctp. Is
that incorrect? From my understanding, the default layout is loaded by every
view and that's why I have my navigation bar in it.  It seems that I can
only access those "set" variables from something like
views/layouts/cars/index.ctp but not views/layouts/default.ctp. Is there a
difference between the model layouts and the default layout?


Miles J wrote:
> 
> 
> Thats what "layouts" are far. They are the wrappers/containers of all
> your views. The layouts should include the headers/footers or your
> HTML as well as the HTML html, head and body tags. Your view should be
> generated within the body of your layout.
> 
> Any data passed to the view will be accessible in the layout.
> 
> No matter what is passed with set(), your layout can access it. If you
> want more usage, try using $this in your layout/view.
> 
> Do a debug($this) in your view to see what parameters you can work
> with.
> 
> On Oct 2, 3:27 pm, hahmadi82  wrote:
>> I'm not talking about passing variables to  the view for that controller.
>> All
>> my views are set up perfectly for every controller.  For my cars class I
>> have a car controller and a views/cars/index.ctp etc which utilizes
>> all
>> the set variables from car_controller.php actions.  This is not an issue
>> for
>> me.
>>
>> The problem is that my webpage toolbar that shows on every page is set up
>> in
>> the view/layout/default.ctp.  However the default.ctp is not associated
>> to
>> any controller so I am not able to access any data from the other
>> controllers.  the default.ctp is weird to me because it also doesn't have
>> it's own controller or model.  So I also can't pull data from other
>> models.
>> All I use the default.ctp for is to have my "Home" "Profile" "Login"
>> "Logout" "Register" buttons which are just $html->link
>> (controller/action).
>> What I want to include in this tool bar is some data from my car class,
>> but
>> I can't figure out how
>>
>>
>>
>> Miles J wrote:
>>
>> > No yours till doing it wrong. You do not need to call render() unless
>> > you want to call a different .ctp file that does not associate with
>> > the current action.
>>
>> > To set/pass data to the view just use the set() method.
>>
>> > $this->set('v', $var);
>>
>> > Then in your view just use it:
>>
>> > echo $v;
>>
>> --
>> View this message in
>> context:http://www.nabble.com/Access-Classes-In-Layout-Help---tp25706283p2572...
>> Sent from the CakePHP mailing list archive at Nabble.com.
> > 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Access-Classes-In-Layout-Help---tp25706283p25725300.html
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 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
-~--~~~~--~~--~--~---



Re: Access Classes In Layout Help??

2009-10-02 Thread Miles J

Thats what "layouts" are far. They are the wrappers/containers of all
your views. The layouts should include the headers/footers or your
HTML as well as the HTML html, head and body tags. Your view should be
generated within the body of your layout.

Any data passed to the view will be accessible in the layout.

No matter what is passed with set(), your layout can access it. If you
want more usage, try using $this in your layout/view.

Do a debug($this) in your view to see what parameters you can work
with.

On Oct 2, 3:27 pm, hahmadi82  wrote:
> I'm not talking about passing variables to  the view for that controller. All
> my views are set up perfectly for every controller.  For my cars class I
> have a car controller and a views/cars/index.ctp etc which utilizes all
> the set variables from car_controller.php actions.  This is not an issue for
> me.
>
> The problem is that my webpage toolbar that shows on every page is set up in
> the view/layout/default.ctp.  However the default.ctp is not associated to
> any controller so I am not able to access any data from the other
> controllers.  the default.ctp is weird to me because it also doesn't have
> it's own controller or model.  So I also can't pull data from other models.
> All I use the default.ctp for is to have my "Home" "Profile" "Login"
> "Logout" "Register" buttons which are just $html->link (controller/action).
> What I want to include in this tool bar is some data from my car class, but
> I can't figure out how
>
>
>
> Miles J wrote:
>
> > No yours till doing it wrong. You do not need to call render() unless
> > you want to call a different .ctp file that does not associate with
> > the current action.
>
> > To set/pass data to the view just use the set() method.
>
> > $this->set('v', $var);
>
> > Then in your view just use it:
>
> > echo $v;
>
> --
> View this message in 
> context:http://www.nabble.com/Access-Classes-In-Layout-Help---tp25706283p2572...
> 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 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
-~--~~~~--~~--~--~---



Re: Access Classes In Layout Help??

2009-10-02 Thread hahmadi82


I'm not talking about passing variables to  the view for that controller. All
my views are set up perfectly for every controller.  For my cars class I
have a car controller and a views/cars/index.ctp etc which utilizes all
the set variables from car_controller.php actions.  This is not an issue for
me.

The problem is that my webpage toolbar that shows on every page is set up in
the view/layout/default.ctp.  However the default.ctp is not associated to
any controller so I am not able to access any data from the other
controllers.  the default.ctp is weird to me because it also doesn't have
it's own controller or model.  So I also can't pull data from other models. 
All I use the default.ctp for is to have my "Home" "Profile" "Login"
"Logout" "Register" buttons which are just $html->link (controller/action). 
What I want to include in this tool bar is some data from my car class, but
I can't figure out how


Miles J wrote:
> 
> 
> No yours till doing it wrong. You do not need to call render() unless
> you want to call a different .ctp file that does not associate with
> the current action.
> 
> To set/pass data to the view just use the set() method.
> 
> $this->set('v', $var);
> 
> Then in your view just use it:
> 
> echo $v;
> > 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Access-Classes-In-Layout-Help---tp25706283p25723661.html
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 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
-~--~~~~--~~--~--~---



Re: Access Classes In Layout Help??

2009-10-02 Thread Miles J

No yours till doing it wrong. You do not need to call render() unless
you want to call a different .ctp file that does not associate with
the current action.

To set/pass data to the view just use the set() method.

$this->set('v', $var);

Then in your view just use it:

echo $v;
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Access Classes In Layout Help??

2009-10-02 Thread hahmadi82


My issue with the cake site is it never gives a thorough description on
anything.  It's why I'm always on nabble asking silly questions :P From what
I read from the link you provided, it seems I need to do something with the
$this->render function. 

The set variables I've already defined do not automatically show up in my
layout/view/default.ctp as the posts above implied.  Where can I call the
render function to properly direct my variables to the layout.  Do put in
the controller action:

$this->render(null, 'layout');

Will that send all that actions set variables to the layout?  Or is there
something I need to call in default.ctp to get that information. 
Unfortunately, I'm still confused about this...


Miles J wrote:
> 
> 
> Perhaps you should read the documentation before proceeding any
> further.
> 
> http://book.cakephp.org/view/57/Controller-Methods
> 
> On Oct 2, 4:11 am, Bert Van den Brande  wrote:
>> Calling $this->set('someInformation', 'someValue') in the controller will
>> make the var $someInformation available in both the view and the layout
>> ...
>> I think :)
>>
>> On Fri, Oct 2, 2009 at 10:08 AM, hahmadi82  wrote:
>>
>> > I'm not sure I follow.  How do I pass the information into the layout
>> file?
>>
>> > Miles J wrote:
>>
>> > > Just put  in your layout file, and
>> > > then Cake will render your controllers view within that variables
>> > > location.
>>
>> > > On Oct 1, 3:05 pm, hahmadi82  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  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.
>>
>> > --
>> > View this message in context:
>> >http://www.nabble.com/Access-Classes-In-Layout-Help---tp25706283p2571...
>> > Sent from the CakePHP mailing list archive at Nabble.com.
> > 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Access-Classes-In-Layout-Help---tp25706283p25722068.html
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 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
-~--~~~~--~~--~--~---



Re: Access Classes In Layout Help??

2009-10-02 Thread Miles J

Perhaps you should read the documentation before proceeding any
further.

http://book.cakephp.org/view/57/Controller-Methods

On Oct 2, 4:11 am, Bert Van den Brande  wrote:
> Calling $this->set('someInformation', 'someValue') in the controller will
> make the var $someInformation available in both the view and the layout ...
> I think :)
>
> On Fri, Oct 2, 2009 at 10:08 AM, hahmadi82  wrote:
>
> > I'm not sure I follow.  How do I pass the information into the layout file?
>
> > Miles J wrote:
>
> > > Just put  in your layout file, and
> > > then Cake will render your controllers view within that variables
> > > location.
>
> > > On Oct 1, 3:05 pm, hahmadi82  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  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.
>
> > --
> > View this message in context:
> >http://www.nabble.com/Access-Classes-In-Layout-Help---tp25706283p2571...
> > 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 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
-~--~~~~--~~--~--~---



Re: Access Classes In Layout Help??

2009-10-02 Thread Bert Van den Brande
Calling $this->set('someInformation', 'someValue') in the controller will
make the var $someInformation available in both the view and the layout ...
I think :)

On Fri, Oct 2, 2009 at 10:08 AM, hahmadi82  wrote:

>
>
> I'm not sure I follow.  How do I pass the information into the layout file?
>
> Miles J wrote:
> >
> >
> > Just put  in your layout file, and
> > then Cake will render your controllers view within that variables
> > location.
> >
> > On Oct 1, 3:05 pm, hahmadi82  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  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.
> > >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Access-Classes-In-Layout-Help---tp25706283p25711954.html
> 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 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
-~--~~~~--~~--~--~---



Re: Access Classes In Layout Help??

2009-10-02 Thread hahmadi82


I'm not sure I follow.  How do I pass the information into the layout file?

Miles J wrote:
> 
> 
> Just put  in your layout file, and
> then Cake will render your controllers view within that variables
> location.
> 
> On Oct 1, 3:05 pm, hahmadi82  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  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.
> > 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Access-Classes-In-Layout-Help---tp25706283p25711954.html
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 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
-~--~~~~--~~--~--~---



Re: Access Classes In Layout Help??

2009-10-01 Thread Bert Van den Brande
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  wrote:

>
> Just put  in your layout file, and
> then Cake will render your controllers view within that variables
> location.
>
> On Oct 1, 3:05 pm, hahmadi82  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  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 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
-~--~~~~--~~--~--~---



Re: Access Classes In Layout Help??

2009-10-01 Thread Miles J

Just put  in your layout file, and
then Cake will render your controllers view within that variables
location.

On Oct 1, 3:05 pm, hahmadi82  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  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 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
-~--~~~~--~~--~--~---



Re: Access Classes In Layout Help??

2009-10-01 Thread hahmadi82


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  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---tp25706283p25707318.html
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 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
-~--~~~~--~~--~--~---



Re: Access Classes In Layout Help??

2009-10-01 Thread Bert Van den Brande
I think he means that he has written a controller+view that generates some
output.

Now he wants to render the same output inside his layout file ...

Correct hahmadi ?

On Thu, Oct 1, 2009 at 11:41 PM, 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  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.
> >
>

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Access Classes In Layout Help??

2009-10-01 Thread Miles J

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  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.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Access Classes In Layout Help??

2009-10-01 Thread hahmadi82


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---tp25706283p25706283.html
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 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
-~--~~~~--~~--~--~---