CodeIgniter Forums
How do you manage navigation in your code / models / views - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: How do you manage navigation in your code / models / views (/thread-28601.html)



How do you manage navigation in your code / models / views - El Forum - 03-16-2010

[eluser]uptown[/eluser]
I'm building an application where different users will have different menu items available to them depending on what they've paid for. There will also be multiple levels to the menu hierarchy.

What's the best approach to this problem?

I'm assuming I need a database table that represents the menu hierarchy, including the parent-child relationships of the nodes in the navigation as well as the sorting of the items. Then another table which I use to manage whether a user is authorized to access a particular item in that table.

When I render the view, I'd reference the menus, and the access rights of the user to output the menu, and I'd also need a function to check that same authorization from each controller in case a user manually types in a URL of a controller they're not supposed to have access to.

Is this the right approach? Any suggestions for caching this to prevent the constant look-ups of this type of info? I'm open to any suggestions on how you may have approached this type of requirement.

Thanks