Welcome Guest, Not a member yet? Register   Sign In
Defining a global variable
#1

[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?
#2

[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
#3

[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.




Theme © iAndrew 2016 - Forum software by © MyBB