Multiple Applications with shared settings in Codeigniter

Asked

Viewed 144 times

0

I have multiple applications in codeigniter where I configured based on that tutorial. Now my briefcase applications is 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/

Both systems are functioning normally, I’ve changed the index.php catching the $application_folder, everything correctly, but a question arose.

How do I split some resources between applications?

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

  • If vc uses Linux, it can be with a symbolic link to the database configuration file.

1 answer

0


To solve it, I created another application and the project was 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 folder applications/config I have the file database.php which is responsible for connecting my database. So how to applications/gerencia and applications/loja uses the same connection, opened the file database.php of these applications and includes the following line:

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

And then the two applications recognized the connection.

Source: https://stackoverflow.com/questions/14475629/sharing-config-among-multiple-applications-in-codeigniter

Browser other questions tagged

You are not signed in. Login or sign up in order to post.