Multiple applications with shared settings in Codeigniter

0

I have multiple applications in the codeigniter where I set up based on this tutorial . Now my applications folder looks like this:

applications/gerencia/
applications/gerencia/config/
applications/gerencia/controllers/
applications/gerencia/libraries/
applications/gerencia/models/
applications/gerencia/views/
applications/loja/
applications/loja/config/
applications/loja/controllers/
applications/loja/libraries/
applications/loja/models/
applications/loja/views/

The two systems are working normally, I changed the index.php by taking $application_folder , everything correctly, however a doubt arose.

How do I split some features between applications?

Example, if I am going to install this project on some server, I need to change the database connection in the applications/gerencia/config/database.php and application/loja/config/database.php folder. But the connection is the same, how do I share this feature and others between the applications in Codeigniter?

    
asked by anonymous 25.07.2018 / 22:14

1 answer

0

To solve, I created another application and the project looks like this:

applications/gerencia/
applications/gerencia/config/
applications/gerencia/controllers/
applications/gerencia/libraries/
applications/gerencia/models/
applications/gerencia/views/

applications/loja/
applications/loja/config/
applications/loja/controllers/
applications/loja/libraries/
applications/loja/models/
applications/loja/views/

applications/config/

In the applications/config folder I have the database.php file that is responsible for connecting my database. So as applications/gerencia and applications/loja uses the same connection, I opened the file database.php of those applications and includes the following line:

include_once(FCPATH . 'applications/config/database.php');

And then the two applications recognized the connection.

Source: link

    
31.07.2018 / 13:51