What is the best practice of having dynamic globals in codeigniter?
I want to load a file with constants based on what key i load from the data I tried libraries, but they are loaded before the models get initialized
How i want it to work:
1) User logs in 2) php checks if this user is a regular user (from database) or an administrator 3) if its a regular user, i will define my global variables accordingly else i will use different global variables
This should happen only once, when person logs in. And this is exactly how i do it:
The person logs in, php checks (in same controller) how the global variables need to be defined. It defines them, but as soon as i call on these variables from another controller they get erased. (I call on another controller with AJAX) Oh and i should also say that CI has bugs when we run multiple AJAX requests at the same time (you cannot use CI sessions if you use simultaneous AJAX)
SO the question really is: How do I prevent them from being erased?
Thanks