hey dood,
i don't know if this would be the best method but you can access the
controller from your views and layouts via:
$this->controller
so you can check for the controller name
if ($this->controller->name == 'Blahs') {
display
}
or for the modelClass
if ($this->controller->modelClass == 'Blah') {
display
}
my knowledge of MVC is fairly new but i tend to access the controller
attributes quite a lot to grab things like the modelClass etc. this
way I can create reusable elements quite easily.
i'm sure there are better ways of doing this, but it works.
cheers,
freedom
On 22/08/06, Bernard Grosperrin <[EMAIL PROTECTED]> wrote:
>
> I need some help with something which looks like the cat chasing it's
> tail, to me, but I am a beginner!
>
> I have a component which I call from the default.thtml view, as I want
> it in a sidebar, and that is defined there. But in fact, I would like
> that component displayed/active only when the user is on a specific set
> of controllers(2). Problem is, if I do not put var $components =
> array('mycomponent') in the app_controller, I get an error, because it's
> called from default.
>
> So, how should I test, from the default view, which controller is
> currently in use?
> Or is there another/better way?
>
> Thanks,
> Bernard
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---