Search code examples
phpcodeignitercodeigniter-3

How to load constants dynamically in Codeigniter?


I have a table alertTypes. On a callback I need to access this table data.Every hour, website receives more than 1k hits from these callbacks. This makes a lot of db queries which I want to reduce. How can be these alertTypes records made global in constants.php?


Solution

  • I have found the answer for this. What I did, I created a pre controller (a type of HOOKS in codeigniter ) which loads all the data needed for the processing. It reduces db queries significantly.