In this case, I prefer to create a component and use it in the
AppController.

I have a lot of problems with $uses in AppController, and the only way
I found to around this was using component.

Best,

On 18 abr, 10:22, Andrew McCafferty <[EMAIL PROTECTED]>
wrote:
> Firstly, the $name of AppController isn't "Nodes" so remove that
> line...
>
> Try replacing it with:
>
> var $uses = array('Node');
>
> This should tell AppController to use your Node model, making the
> findAllThreaded function available.
>
> On 18 Apr, 06:17, double07 <[EMAIL PROTECTED]> wrote:
>
> > Hi All,
>
> > I'm trying to setup a global css navigation menu. Basically All my
> > pages for the site are in a table called 'nodes'. Each page has a
> > parent_id so I can use findAllThreaded() to generate an unordered list
> > using a 'tree' helper (http://bakery.cakephp.org/articles/view/64) I
> > found in the bakery.
>
> > Now when I set this up in a specific function within the Nodes
> > controller it works fine. example:
>
> > In the function 'edit' within the nodes controller I have this bit of
> > code:
> > $this->set('category_tree', $this->Node->generateList());
>
> > In my default layout page I have:
> > echo $tree->show('Node/title', $menu);
>
> > Obviously this only works when I'm in - /nodes/edit/x
>
> > What I want is to have that navigation available on every single page
> > so I don't have to set the menu variable in each function in each
> > controller. From my research around the place it seems that using
> > beforeFilter() in AppController is what I'm looking for, but I'm not
> > sure my syntax is correct as I get this error:
> > Notice: Undefined property: PagesController::$Node in C:\wamp\www\cake
> > \cake\app_controller.php on line 64
> > Fatal error: Call to a member function findAllThreaded() on a non-
> > object in C:\wamp\www\cake\cake\app_controller.php on line 64
>
> > In my app_controller.php file I have:
>
> > class AppController extends Controller {
>
> >         var $name = 'Nodes';
> >         var $components  = array('othAuth');
> >         var $helpers = array('Html', 'OthAuth');
> >         var $othAuthRestrictions = array( 'add','edit','delete');
>
> >         function beforeFilter()
> >     {
>
> >         $this->set('menu', $this->Node->findAllThreaded()); //This is
> > the line in question
>
> >         $auth_conf = array(
> >                     'mode'  => 'oth',
> >                     'login_page'  => '/users/login',
> >                     'logout_page' => '/users/logout',
> >                     'access_page' => '/',
> >                     'hashkey'     => 'MySEcEeTHaSHKeYz',
> >                     'noaccess_page' => '/users/noaccess',
> >                     'strict_gid_check' => false);
>
> >         $this->othAuth->controller = &$this;
> >         $this->othAuth->init($auth_conf);
> >         $this->othAuth->check();
>
> >     }
>
> > }
>
> > Could somebody please give me some pointers or tell me if I'm on the
> > right track. If not are there any suggestions to achieve what I'm
> > trying to do?
>
> > Thanks in advance.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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