Best way to attach specific controller to nested nav
I'm pondering on an issue on how to tie in controllers to a nested nav. I have created a nav table on my database that simply works with page_ID and parent_ID when pages are subpages. This is all handled within an MVC structure.
This is a short overview of the tables:
Now, I itterate over the nav based on the parent_ID and this all happens in a controller to handle pages. Now at the point of 'Houseproject 1' I want to handle the data via a projects controller.
DB Table: nav
page_ID - Parent_ID - pagename - controller
1 0 Projects - pages
2 1 Houses - pages
3 2 Houseproject 1 - projects
DB Table: projects
project_ID - page_ID - pagename
1 3 - Houseproject 1
Right now my urls are:
/cms/pages/view/1 (show houses)
/cms/pages/view/2 (show Houseproject 1)
/cms/projects/view/3 (show Houseproject 1)
What is the best, and most logical approach to doing this? What would the urls look like? And where should the projectname go, in the nav or in the projecttable. And when I edit a project in the current situation i need to update table:nav for the pagename as well.
What would be a good DB structure and a good approach of handling data this way?
So far so good, however at some point I want to be able to attach a controller.