Reputation: 559
Hello I'm building my own PHP MVC framework. Not with the intention of using it. But I'm trying to learn PHP5 OO and the MVC design pattern.
I've read a lot of tutorials and got the basics working but now I'm stuck since things are getting more complicated.
My framework uses the following URL structure: /controller/action. Optionally followed by an inifinite number of variables, e.g. /product/view/1.
So far I got two separate controllers: page and product. I wan't to include them both in a single menu. I'm trying to establish the following menu structure. The corrosponding URL is between brackets.
So basically I got a main menu and a sub menu. There are a few requirements I defined for the menu class:
I've got a copy of my 'framework' running here: http://www.eriknijland.nl/stackoverflow/. The content is in Dutch though and the menu is just static HTML.
The source code is available for download as well in the folder:
Any other comments on my code are welcome as well :P.
Upvotes: 2
Views: 3557
Reputation: 1253
All the code to build that should be in the view layer of the application. Of course, the framework should provide methods to know wich module and action are active, but the behavior of the menu should be implemented in the application and not in the framework.
Another option would be to design the framework so that it provides some helpers to build menus automatically. In this case, everything should be implemented within the view layer of the framework.
Upvotes: 1