Holding website settings and multiple validations in constructor of each controller

I just started to work with Codeigniter 3 latest version and i get into some points where i stucked kind off.
In my old php code (no framework) and website structure i had one file index.php that was holding all logged in user and website settings. Each page was different ‘case’ which was loaded file that was matching ‘case’.

Now when i started to work in Codeigniter i see that this is impossible to make, at least for me and now, i mean it is possible but its against MVC rules.

For example i have few controllers, Accounts, Profile, Home, Login and in constructor of each controller i loaded website settings, check if user is logged in and many other stuff (too much code).

I know this is not good and bad practice but if i need to make some changes i need to do it in each controller but i don’t find other way of doing it.
I saw that you can make like main model where you can put all those stuff and call that main model by extending class with that model.

What i want to know is there any other way to have all those settings loaded in every controller i need without making new model and extending it, i want to keep extending CI_Controller ?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.