• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
different menu items for different users

#1
[eluser]gtipete[/eluser]
I have a page controller and model, which do certain things such as get the menu items out of a database. In the controller i have a function called prepMenu() which checks to see what type of user is logged in, and gives them different custom menu items.

Now, i want all of my other views to be loaded inside the page view, but the menu array is passed in from the page controller.

Would it be a good idea to move the menu operations into its own model and then autoload it, so that it can be used on any view?

And can you do the following inside a model?
Code:
$this->output->set_header("Cache-Control: no-store, no-cache, must-revalidate, no-transform, max-age=0, post-check=0, pre-check=0");
        $this->output->set_header("Pragma: no-cache");

#2
[eluser]Crafter[/eluser]
Quote:Would it be a good idea to move the menu operations into its own model and then autoload it, so that it can be used on any view?

I use that approach. Auto loading the model won't run the code to build the menu items, You will need to call the model function to do that.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.