That's because PagesController doesn't know about Category. You can't
use $this->something unless the class/object has a 'something'
property. You'd need to import the CategoriesController class and
instantitate it (as, eg. $categories).

But you'd probably be far better off taking this out of
PagesController entirely and creating a menu element. In that, use
requestAction() to get the data directly from CategoriesController.
Just remember to use caching so that you're not fetching this data on
every page request.

On Tue, Jul 21, 2009 at 1:17 PM, Yannis<[email protected]> wrote:
>
> Thank you very much for the prompt reply, I've tried that.
> However I get an error, when trying to access the Category:
> [The full code goes like that]
>
> $this->Category->contain(...);
> $stuff = $this->Category->find(...);
> $this->set(compact('stuff'));
>
> I get an error:
> Notice (8): Undefined property:  PagesController::$Category [APP/
> app_controller.php, line 9]
>
> Fatal error: Call to a member function contain() on a non-object in /
> Applications/MAMP/cakephp/learning/sylor/app_controller.php on line 9
>
> Any help?
> >
>

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

Reply via email to