简体   繁体   中英

Sharing codeigniter models,config, and libraries with multiple apps

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.

  • test.com
  • 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

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM