Welcome Guest, Not a member yet? Register   Sign In
Hello
#1

[eluser]paulipv[/eluser]
Using: CI (v. 2.0)

I'm not sure if that question has been discussed but i wanna know if posible to use
multiple applications and 1 base config.

For example:

app/
config/
core/
libaries/
etc/
admin_app
controllers/
models/
store_app
controllers/
models/

Why that?
Lets say we want a big application folder where we can extend core libraries.


- We want to create a base controller that handle some actions for both applications.
- In admin_app we create our admin controller that extend base controller and set admin application settings only.

Ex:

Code:
Base_Controller extends CI_Controller {
    here comes some settings that are applied for both application
}

(admin)

Code:
Admin_Controller extends Base_Controller {
      here comes extra admin settings (like login check, access level, etc).
}

- We want to create models that can be available for both application (admin/store).
etc, etc.

AND ...
If we define for example in admin application config/database.php config will be rewrited (database connection for this application will be app/admin/config/database instead of /app/config/database.php

I know that is not posible at the moment, however with that CodeIgniter in my opinion
comes more and more flexible.

Maybe in future version with our suggestions or maybe help we can implement that Smile

For example doing that in Front Controller:

Code:
$myApps = array(
     array('name' => 'admin'    , 'path' => 'app/admin/'    , 'prefix' => 'Admin_')   ,
     array('name' => 'store'    , 'path' => 'app/store/'    , 'prefix' => 'Store_')   ,
     array('name' => 'otherApp' , 'path' => 'app/otherApp/' , 'prefix' => 'Other')
);

CI::Front('basePath' => 'app/', 'baseClassPrefix' => 'Base_', $myApps);

// Run the application admin
CI:RunApp('store');

Example controller:

Code:
class Cart extends Store_Controller {
  
   function index() {
    
     // Need admin accounts
     // Loading a model from admin application
     $this-load->modelFrom('Admin/Accounts' , 'admin');
      
     Where 2nd param ('admin') is the application name,
     if empty will search in base app.    
  
  }


}




Theme © iAndrew 2016 - Forum software by © MyBB