Reputation: 2701
Am expanding a site built with codeigniter, its to have an api and mobile version. I intended to seperate the api and mobile site from the main site using sub domains.
api.test.com
m.test.com
There are many models,and libraries already written for the main site which is to be used by the site,api, and mobile, and i do not want to replicate them. Am working with codeigniter 2.1.0. Any help will be appreciated. Thanks
Upvotes: 2
Views: 2238
Reputation: 3765
Look into using Application Packages. You could add your main site application/
folder to your API and mobile sites as an application package. CodeIgniter will then fall back to looking into your main site application/
folder when you attempt to load resources.
Using this method you could use the same models, helpers, and libraries between all three of your applications but write custom controllers and views for your API and mobile sites.
Edit (1/12/2012): For anyone interested, I wrote a blog post about this question discussing the usage of application packages. The post can be read here.
Upvotes: 6