Hi All,
CodeCowboy - the wiki page I wrote was intended to 'show the way' (or
at least one way) to manage dynamic menu (or other generic data for
that matter) generation, but I didn't intend to address how to get the
menu data as that's often project specific. As you know, writing lots
of fixed arrays in a switch is a bit restrictive and cumbersome. From
the sounds of it you need a DB solution so that you can just call a
component/method with parameters and get back your menu array data (or
to follow the withcake way).
For contrast/discussion:
For this case I don't need any extra parameters in my uls and recently
took a different approach. I created some methods in app_controller:
_defineMenuMain
_defineMenuContext
.. which contain some generic logic, but can be overriden of course by
any controller; in the beforeRender method I call
$this->set('MenuMain',$this->_defineMenuMain();
$this->set('MenuContext',$this->_defineMenuContext(););
The logic in this case is that I wanted to create a context menu which
with a few exceptions is based upon the controller methods (e.g.
defineMenuContext returns the controller methods that can be called
without parameters), and the logical place to put the code to work that
out was in the controller (so that it could be overriden where needed).
Re making the menu smart - you can explode the url and compare it with
your controller name and action to see where you are, and Armando's
funky link helper would take care of the presentation side if you pass
the right parameters.
HTH,
AD7six
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---