Live Streaming In Sidebar Firefox Date and Time validation using Regular Expression
Jan 062010

Your application in code igniter is a PHP-Site.You can use Code Igniter to create multiple application using one core. You can create subdomain for each application (not only one domain).

But still in one model for one application. so the application has their own model. and the model can’t be used by other application. :p

Imagine if you has multiple application with the same feature and same database and the application is connected(integrated). so you create a model using copy paste? maybe it can be a problem if you forgot to copy paste.

How to use multiple application using one core and one model? so the application you has created just using one model. and you just create and edit one file. :D interesting.

let me see your code igniter three view:

SERVER
|–>CodeIgniterCore
|      |–>system
|             |–>codeigniter
|             |–>helpers
|             |–>plugins
|–>Application1
|      |–>config
|      |–>controllers
|      |–>models //the model for application1 is here
|      |–>views
|–>Application2
|      |–>config
|      |–>controllers
|      |–>models //the model for application2 is here
|      |–>views
|–>App3

the model in each application is in the applicaation(not in CodeIgniter core). because the function of $this->load->model(”model_name”) is load the model in the APPPATH. so the models directory is must be in the APPPATH directory.

how to change it?

1. Open file Loader.php in CodeIgniter/system/libraries.

2. Find the function model($model, $name = ”, $db_conn = FALSE). this is the function if you using $this->load->model(”model_name”) on controller or instance.

3. Replace the APPPATH with BASEPATH in the function no.2

4. Move your models directory from application directory to the BASEPATH directory (CodeIgniter/system)

5. Its done.

Now your code igniter three view is:

SERVER
|–>CodeIgniterCore
|      |–>system
|             |–>codeigniter
|             |–>helpers
|             |–>models //the model for all your applications is here
|             |–>plugins
|–>Application1
|      |–>config
|      |–>controllers
|      |–>views
|–>Application2
|      |–>config
|      |–>controllers
|      |–>views
|–>App3

try to manage the model for your creation.

now you can use the $this->load->model(”model_name”) like usually you do it.

thanks for reading. :D

Practice can be fun
  • Facebook
  • Twitter
  • del.icio.us
  • MySpace
  • Digg
  • Mixx
  • StumbleUpon
  • Yahoo! Buzz
  • Google Bookmarks
  • Print

Leave a Reply

(required)

(required)