I have the same app (made in CodeIgniter) running on the same server for three different clients.
The app is mostly the same, but each client has its own modifications (and its own subdomain), but right now any time I have to do a general modification I have to go through the app of all three clients and perform the modification.
What I want to have is:
The app deployed only once, and some kind of control there if you go to
client1.example.com/method1
The app looks for method1 in the controller client1.php, if method1 is found, it loads that instead, else, look for method1 in the controller default.php
That way, I can have general methods for all the clients load from the same source, and then specific controller for each client with their specific methods.
P.S. The methods are basically the same, but the different needs of the clients require to be able to make big modifications to each one.
Any help would be appreciated.
EDIT:
Ok, let me try to be more clear.
In wiredesignz Modular Extensions - HMVC, when you call index.php/welcome, it looks for it in the default controller. When you load a module and call index.php/welcome, it looks for it in the module directory first, if it's not found, will default to the default controller.
How can I achieve this without the module functionality?
Ok Well... if i explain your question.
assume i have URL's like this (home is my default controller )
http://stackoverflow.com/home/method_1 # Exist in my controller
http://stackoverflow.com/home/method_2 # Exist in my controller
http://stackoverflow.com/home/method_3 # NOT in my controller <---------
http://stackoverflow.com/home/method_4 # Exist in my controller
In above links 3rd URL is not exist.
With your question I got a Question. If URL is not there How User can access the link ??. No one know about your url unless you defined it. Users will not type URL in the browsers. Ok well will go ahead.
So as better solution i got is, If page not exist we call it has 404 overriding. So you can use Codeigniter 404_override
in routes.php
http://stackoverflow.com/home/method_1 # Valid URL
http://stackoverflow.com/home/method_2 # Valid URL
http://stackoverflow.com/home/method_3 # 404 ERROR <---------
http://stackoverflow.com/home/method_4 # Valid URL
In application/config/routes.php
$route['404_override'] = ''; # set this to your home controller
class defaultcontroller
{
protected function method1()
{
//default.php
}
}
class client1 extends defaultcontroller
{
public function method1()
{
//client1.php
//if this method existed,it will be executed
//or the same method in defaultcontroller will be excuted
}
}
you can do the same thing in client2.php and client3.php