help with php MVC problem
I have groups on my site and the urls have the following hierarchy:
/ groups / {id_group} /
/ groups / {id_group} / news
/ groups / {id_group} / gallery
/ groups / {id_group} / events
/ groups / {id_group} / events / {id_event}
/ groups / {id_group} / events / {i开发者_如何学God_event} / news
/ groups / {id_group} / events / {id_event} / gallery
/ groups / {id_group} / events / {id_event} / news
As you can see a group can have news, gallery, etc. and in turn an event that is in a group can also have news, gallery, etc.
How to implement this approach in a framework without specifying any specific one?, ie I would like some guidance on what would have modules, controllers, etc.
Thanks.
All this can be achived with a simple controller , however there might be tons of variations of module/controller/action mapping , realy depends on what you need to display on the pages and how you're app is setup to work .
To get all this in one simple controller you could do the following :
/ groups / {id_group} /
Controller groups , default action
/ groups / {id_group} / news
Controller groups , news action
...
/ groups / {id_group} / events
Controller groups , events action
/ groups / {id_group} / events / {id_event}
Controller groups , specific event action. Here depending on you're framework you can either route it to a specific action , or you can test in events action if an id is sent and forward the required specific event action
...
Edit
if events/news/whatever , do have actions on they'r own i would have specifict events controller , specific news controller and so on , you can eaven go further and have them all separated in different modules ( for example this would allow you to have an adminNewsController , frontendNewsController with newsModel all in one place for the news module ) .
精彩评论