Welcome Guest, Not a member yet? Register   Sign In
Best way to set global vars/constants?

Hey guys, just curious. I have a ton of things I would like to set to global constants I can use anywhere just for ease of the use in the future in case I change anything. My best example is I'm constantly using $this->db->from("articles") or something of the sort, I'd rather have a constant defined as ARTICLES_TABLE and always refer to it as that so if the table name changed I could change it in one file for every query, among other things.


Constants file in the /application/config folder

Well you can't use models in the application/config/constants.php file... but you can create a base controller which contains the global variables and then extend it from each new controller you create.


Theme © iAndrew 2016 - Forum software by © MyBB