I have two applications developed in CodeIgniter, both are working on separate server, i.e.
www.CI_App_1.com
and
www.CI_App_2.com
Now I want to integrate CI_App_2
into CI_App_1
application, so after that I'm able to call default_controller
of CI_App_2
from one of link from CI_App_1
.
My folder structure :
htdocs :
-application_1
-application
-application_2
-application
-config
-autoload.php
-config.php
-routes.php
-controllers
-app_2_controller.php
-helpers
-libraries
-models
-app_2_model.php
-views
-app_2_view.php
-system
-.htaccess
-index.php
-config
-autoload.php
-config.php
-routes.php
-controllers
-app_1_controller.php
-helpers
-libraries
-models
-app_1_model.php
-views
-app_1_view.php
-system
-.htaccess
-index.php
I want to access CI_App_2 after user is logedin from CI_App_1
. After authenticating process user is able access my CI_App_2
only, If user try to access it without authenticating, got an error message :
Access forbidden
I referred following links :
Call Controller method of CodeIgniter outside Application directory
CodeIgniter: Load controller within controller
How to load a controller from another controller in codeigniter?
Codeigniter : calling a method of one controller from other
http://www.techsirius.com/2013/01/load-controller-within-another.html
https://www.quora.com/Can-I-call-a-controller-function-that-resides-in-another-controller-in-CodeIgniter
http://www.devnetwork.net/viewtopic.php?f=72&t=131353
how to set up two codeigniter applications running on same server
https://www.codeigniter.com/user_guide/general/managing_apps.html
But in above links they said that it should be done using HMVC module structure, but not any one mention that both controller files are from same application or different. I want to access default_controller
from second application into first application.
Is it possible ?
Any kind of help is appreciated. Thanks in advance. Hope you got my question.
Following function set on application_1 default_controller may be its work.
public function _remap($method) {
$userdata = $this->session->userdata('user');
if (!empty($userdata)) {
modules::run('application_2/controller/default_controller');
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With