Welcome Guest, Not a member yet? Register   Sign In
Global Loader Class
#2

[eluser]bretticus[/eluser]
Most people prefer to implement modular separation in similar scenarios. MS allows you to copy modules to and from application folders as needed. However, I understand that you just want a global folder for common functions, etc. It's actually easier than you think. Please note: I've never done this, but all you need to do is specify a path in your index.php file to a common system folder. The CI Loader function eventually checks the system folders for files to load. For example, your index.php files:

Code:
/*
|---------------------------------------------------------------
| SYSTEM FOLDER NAME
|---------------------------------------------------------------
|
| This variable must contain the name of your "system" folder.
| Include the path if the folder is not in the same  directory
| as this file.
|
| NO TRAILING SLASH!
|
*/
    $system_folder = "/path/to/common/system";

Make sure each one of your application index.php files have the same path. You can remove the system folders from each one as they are not needed.

Next, add "common" folders to your system folders:

Code:
/path/to/common/system/helpers/common
/path/to/common/system/libraries/common

Doing this will make it slightly easier to upgrade system, but the real benefit is to distinguish "common" files from application-specific files.

It should be as easy as:

Code:
$this->load->helper('common/foo');

and

Code:
$this->load->library('common/bar');

This all *should* work. Please try it and let us know.


Messages In This Thread
Global Loader Class - by El Forum - 08-10-2010, 09:32 AM
Global Loader Class - by El Forum - 08-10-2010, 10:17 AM
Global Loader Class - by El Forum - 08-10-2010, 10:25 AM
Global Loader Class - by El Forum - 08-10-2010, 12:39 PM
Global Loader Class - by El Forum - 08-10-2010, 12:52 PM
Global Loader Class - by El Forum - 08-10-2010, 12:58 PM
Global Loader Class - by El Forum - 08-10-2010, 01:07 PM
Global Loader Class - by El Forum - 08-10-2010, 01:08 PM
Global Loader Class - by El Forum - 08-10-2010, 01:11 PM
Global Loader Class - by El Forum - 08-10-2010, 01:23 PM
Global Loader Class - by El Forum - 08-10-2010, 01:58 PM



Theme © iAndrew 2016 - Forum software by © MyBB