Welcome Guest, Not a member yet? Register   Sign In
Loading some data from database for all views in an application

[eluser]Nameless One[/eluser]
I'm building a website which will have a navigation bar with some items "hardcoded" in the view and some links to static pages that will be defined in the database. Since the navigation bar will be displayed on every page, I need those few database rows in every view so that I could insert them as items in the navigation ul element.

Is there any way to do this without fetching those rows in every controller action?


Create a MY_Controller in application/libraries then add your code to that and extend that controller in all of your other controllers.

You can fnd the information for this in the users guide.


[eluser]Nameless One[/eluser]
That's for the suggestion. I've already come to the same conclusion myself. Wish there was some more elegant way in CI, like a support for HMVC for example.



it's very easy to set it up!

Theme © iAndrew 2016 - Forum software by © MyBB