I'm still trying to find a way to launch a mobile site. I have a web application in CodeIgniter, and I would like to create a mobile version of it. However, I do not want to rewrite too much code, especially my models. (Because they return raw data, which I can use anywhere.)
I want to run my mobile site in a subdomain ( m.mydomain.tld ). The desktop version runs www.mydomain.tld . I tried to specify a subdomain in the CI application folder; when the mobile browser arrives at www.mydomain.tld , I redirect it to m.mydomain.tld . This subdomain, as I said, pointed to my CI application folder; Then I serve mobile optimized controllers and views.
However! As stated in app/config/config.php , the base_url of my application:
$config['base_url'] = 'http://www.mydomain.tld/';
Therefore, redirecting to m.mydomain.tld really does not work, because I am still redirecting to www , and I do not want this, although it does what I want it to do.
The way I'm trying to solve this is to create two application folders with different controllers / views, as well as with common models, etc. So, I'm trying to figure out a way to restructure the CodeIgniter application so that I can share my models and the "user controller" (MY_Controller), as well as some user libraries / helpers between different applications.
I hope this is clear, if it is not with pleasure that I explain more about what I am looking for. Many thanks!
source share