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/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: How do you manage navigation in your code / models / views (/showthread.php?tid=28601)



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