Defining a global variable |
[eluser]carlhussey[/eluser]
I have a Menu model that I made that gets loaded into my view. I want to be able to just autoload the model but I need to pass the URI to the model so it can set classes. Is there a way to do this? Can i include the URI functions in the model it self so whatever controller calls the model, it will just proccess the URI of the page its loaded into?
[eluser]LuckyFella73[/eluser]
You can extend the CI_Controller and set a variable that is then available in your model. See Phils blog: http://philsturgeon.co.uk/blog/2010/02/C...ing-it-DRY
[eluser]Aken[/eluser]
You can use the URI class inside your model and it will pull that particular page's url structure just like in a controller. |
Welcome Guest, Not a member yet? Register Sign In |