0

I am totally new to the world of codeigniter and php. I have taken over a code and looking to fix small issues.

Can someone guide me to load or autoload the configuration file of parent controller from the sub controllers?

also how to use the DB configuration file from parent for the sub controllers? so that I need to maintain only one config file.

My folder structure is:

  • Main folder > Application > config > user-defined config File

  • Admin Main folder > Admin > Controller > Customer Main folder > Customer > Controller

The admin and customer should be able to load the config file which is located in the Main Folder > application > config.

Currently I am able to load only from Main Folder > Admin > application > config

Vickel
  • 7,879
  • 6
  • 35
  • 56
  • what do you mean by sub controllers? Are you running Codeigniter with Modular Extensions - HMVC? Or do you reference on a controller located in a sub directory? – Vickel Feb 23 '19 at 00:00
  • can you show your code so far ? – M.Hemant Feb 23 '19 at 02:56
  • I have a codeigniter structure which host my welcome site (Parent controller). inside my parent controller, I have another folder structures of codeigniter for one for Handling Admin page, second for registered user. – SpeedRacer Feb 23 '19 at 09:27
  • @M.Hemant: Sorry for asking, this is because of my lack of experience in php. Do you like to see the folder structure or can you please specifiy, what is meant by code. My folder structure Main folder > Application > config > user-defined config File Admin Main folder > Admin > Controller > Customer Main folder > Customer > Controller The admin and customer should be able to load the config file which is located in the Main Folder > application > config. Currently I am able to load only from Main Folder > Admin > application > config – SpeedRacer Feb 23 '19 at 09:28
  • You don't need an entirely separate directory structure for your admin pages. In fact, your CodeIgniter application should enforce admin authentication and permissions. – S. Imp Feb 23 '19 at 16:38
  • @S.Imp Since, i have taken over the code and new to the world of php and the CodeIgniter. I don't wanted to take the risk of restructuring. – SpeedRacer Feb 23 '19 at 22:18

0 Answers0