CodeIgniter Forums
common controllers across applications - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: common controllers across applications (/showthread.php?tid=7901)



common controllers across applications - El Forum - 04-26-2008

[eluser]palaniappanc[/eluser]
I'm trying to find a way to share controllers between multiple applications. here's my setup :

commonapp (contains the common controllers and models)
appA (accessed from appA.com)
appB (accessed from appB.com)
...

I want appA.com/controllerX/functionY and appB.com/controllerX/functionY to call the same controller that is located at commonapp/controllers/controllerX

What are the ways to do this, assuming I can't create symlinks?

Thank you!


common controllers across applications - El Forum - 06-13-2008

[eluser]doni[/eluser]
you might try this function to call any controller you'd like
Code:
function get_class( $path )
{
      require_once( realpath( $path.'.php' ) );

      $name = end( explode( '/', $path ) );

      $class = ucfirst( $name );

      $ci =& get_instance();

      $ci->$name =& new $class();

      return $ci->$name;

}



common controllers across applications - El Forum - 06-13-2008

[eluser]wiredesignz[/eluser]
@palaniappanc, redirect()? , webservice? or Modular Extensions.