CI Framework two application share the same set of model

Source: Internet
Author: User

    Now that you want to share the model file, tell the system where to load our file. This work is done in the loader.php class, so you need to modify the default behavior:
    
/ * *     * List of paths to load models from     *     * @var Array     * @access protected     */
    
      >
     protected
     $_ci_model_paths        
     array();
    

1
/**2 * Constructor3 *4 * Sets the path to the view files and gets the initial output buffering level5 */6 Public function__construct ()7 {8 $this->_ci_ob_level =Ob_get_level();9 $this->_ci_library_paths =Array(APPPATH,basepath);Ten $this->_ci_helper_paths =Array(APPPATH,basepath); One A //$this->_ci_model_paths = Array (APPPATH); Default path for model - - $this->_ci_model_paths =Array(Fcpath);//Modify the _ci_model_paths to a common/target path! the - $this->_ci_model_paths =Array(APPPATH, Fcpath);//specify that we can get our model files from both the APPPATH and Fcpath directories! - - + $this->_ci_view_paths =Array(APPPATH. ' views/' =TRUE); - +Log_message (' Debug ', "Loader Class Initialized"); A } at - not recommended to directly modify the source code, it is best to extend the CI!. -Create a my_loader in application/core/.PHP -Note, however, that there are two apps in the foreground and backstage, so there is a my_loader in the core directory in two places.PHP Extensions! -<?PHP - defined(' BasePath ') ORExit(' No Direct script Access allowed! '); in - classMy_loaderextendsCi_loader { to Public function__construct () { +Parent::__construct (); - the //specify that we can get our model files from both the APPPATH and Fcpath directories! * $this->_ci_model_paths =Array(APPPATH,Fcpath);
Or:
Array (Common_path);
3 9 }

Similarly, to allow the site to support multiple sets of templates/skins also to extend the class. The corresponding properties are:
/* *     * List of paths to load views from     *     * @var Array     * @access protected     */
    
      >
     protected
     $_ci_view_paths        
     array();
    

CI Framework two application share the same set of model

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.