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.
- Our company (/page/view/2)
- Werkwijze (/page/view/3)
- Staff (/page/view/4)
- Our products (/product/index)
- Bread (/product/category/1)
- Banket (/product/category/2)
- Cake (/product/category/3)
- Contact (/page/view/5)
So basically I got a main menu and a sub menu. There are a few requirements I defined for the menu class:
- The current item should have a different CSS class in the menu.
- If the current item has a parent than that should have a different CSS class as well.
- The menu should be expandable using all kinds of content a URL's.
- And for bonus points: when I select a product from the Bread category. Let's say /product/view/1; then I'd like the 'Our products' and 'Bread' menu items to be highlighted as well.
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:
- /stackoverflow/source/framework.zip
- /stackoverflow/source/framework.sql
Any other comments on my code are welcome as well :P.