There are a couple of things to keep in mind in this discussion.  
First, if you use full page caching putting a requestAction in and  
element that called a menu controller would be better. You can always  
use <cake:nocache>dont cache this </cake:nocache> Also, as of version  
1.2 you will be able to specifically cache certain elements.

However its also possible to do this in app controller as Felix  
suggests but I would write it like this:
class AppController extends Controller
{
     var $useMenu = true;
     function beforeRender()
     {
        if($this->useMenu) {
                 $Menu = & new Menu();
                 $menuArray = $Menu->findAllThreaded(null, null, array 
('position' => 'ASC', 'id' => 'ASC'));
         } else {
               $menuArray = null;
         }
        $this->set('menu', $menuArray);
     }

}

Using the beforeRender method is a better place in case you use  
requestAction to not return a view.
As was previously stated requestAction is not much slower when it  
does not have to return a view. So, if you are using it in an element  
to just get the data needed you will not notice much of a speed  
difference over the above code. The slowest part of Cake is the model  
as in any application. View is the next slowest piece. The dispatcher  
and controller operate much faster.

Bake on.



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

Reply via email to