Welcome Guest, Not a member yet? Register   Sign In
Where do I put a function that I want to execute on every page load?
#1

[eluser]smick[/eluser]
Hey Guys,

Been using CI for a while now but there is one thing I still don't understand.

Say I have a script that I need to execute on every page of the site, before I load my view files or call my controllers, where do I put it?

I'm working with an ip to location script and I need to establish the user's location so I can use the data in my controller.

The script checks to see if the user's location is stored in a session, if not it calls a web service and retrieves it. I want the session data to always be available. In other words, every time I want to call it I don't want to have to call a helper, just $location = $this->session->userdata('location');

Thanks for any help. It's probably obvious, but I'm just not sure how to go about it.


Messages In This Thread
Where do I put a function that I want to execute on every page load? - by El Forum - 09-17-2010, 01:54 PM



Theme © iAndrew 2016 - Forum software by © MyBB