You can pass a second value to init, which is the type. Not really clear what the options are, but I think "Controller" would work.
Your code looks fine, although you don't need to call constructClasses and Component->initialize just to get the menu items. Although maybe you're doing something later where you need that... -Matt http://www.pseudocoder.com On Feb 11, 2:57 pm, Evert <[email protected]> wrote: > What do you think about this code? > > <?php > class AppController extends Controller { > var $plugins = array(); > var $normalMenu = array(); > var $adminMenu = array(); > > function beforeFilter() { > $this->plugins = Configure::listObjects('plugin'); > $cnt = count($this->plugins); > > for ($i=0;$i<$cnt;++$i) { > $this->plugins[$i] = > Inflector::camelize($this->plugins[$i]); > App::import ('Controller', > $this->plugins[$i].'.'.$this->plugins > [$i]); > $this->plugins[$i] = > $this->plugins[$i].'Controller'; > $this->plugins[$i] =& new $this->plugins[$i]; > > $this->plugins[$i]->constructClasses(); > > $this->plugins[$i]->Component->initialize($controller); > > if (isset($this->plugins[$i]->menuLinks)) > {$normalMenu[] = $this->plugins[$i]->menuLinks;} > > if (isset($this->plugins[$i]->adminLinks)) > {$adminMenu[] = $this->plugins[$i]->adminLinks;} > > } > } > } > ?> --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
