I’m building a small MVC framewrok for a specific PHP application – using Doctrine as ORM.
I’d like to know what it would be the best practice to manage the frontend Menu.
My application has 3 menus (horizontal menu, left menu, bottom/footer menu) that can be edited by the site Admin (the menu is stored in a Doctrine NestedSet).
Where should be located the code that calls and renders the Menu? Each controller should be able to call the creation of the menu, according to its requirements (say, for a controller the user do not want the left menu to be displayed).
Locating this function in the Menu Model would be inappropriate I guess…
The controller should call the code to render the Menu, and use any data from your database within the Model, if needed. Then dispatch the results to your View.
Here is a little breakdown
View
Model
Controller