Extended Loader - with Bonus Features! |
[eluser]solepixel[/eluser]
Features: - Load models and libraries from another CI application on the same server - Autoload models and libraries with aliases from the autoload config file. Changes: - Summary: Basically APPPATH can be overridden by a 4th method parameter $apppath - Line 5: private $apppath variable - Line 11: set initial value of $apppath to APPPATH - Line 14: add 4th paramater to model() method for $apppath - Lines 18-21: set array key $alias for auto-loading model aliasing support - Lines 62-65: override $this->apppath for all future model requests - Line 68: APPPATH was replaced with $this->apppath - Line 86: APPPATH was replaced with $this->apppath - Line 97: add 4th paramater to library() method for $apppath - Lines 109-111: override $this->apppath for all future library requests - Line 158: APPPATH was replaced with $this->apppath - Line 202: APPPATH was replaced with $this->apppath - Lines 380-383: set array key $alias for auto-loading library aliasing support Notes: The only tricky part is that models and libraries loaded from other applications must be loaded last in the application. (i.e. do not load any other models after loading a remote one, or set the path back to APPPATH) This is due to the fact that if a "foreign" model loads another "foreign" model, the alternate apppath stays consistent to successfully load those models. Foreign Model Loading Usage: Code: $this->load->model('m_foreignmodel','mod',false,'../public_html/app_site/'); Autoloading with Aliases: Code: $autoload['model'] = array('alias' => 'm_aliasmodel'); Source: http://solepixel.pastebin.com/6DHpxXuz |
Messages In This Thread |
Extended Loader - with Bonus Features! - by El Forum - 04-08-2010, 03:58 PM
|