My situation is that, I have 20 controllers in my website, where I have a function like this.
$this->lang->load("main", $this->session->userdata("lang_code"));
How can I load this function in all the 20 controllers without adding it individually to the __constructor
of every controller?
You can create a library for this purpose and autoload this library. Creating a library is explained in the given link codeigniter library
Or you can refer to a somewhat same question asked in the stackoverflow Stack overflow post