Friday, October 2, 2009

Re: Access Classes In Layout Help??

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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: