コード例 #1
0
ファイル: CMS.class.php プロジェクト: cheevauva/trash
 public function __construct()
 {
     Lib()->new_cms->load('app');
     Lib()->new_cms->load('model');
 }
コード例 #2
0
 function _ci_autoloader()
 {
     Lib(false);
     // load all that has been loaded by the front controller
     parent::_ci_autoloader();
 }
コード例 #3
0
/**
 * Static accessor for all models.
 *
 * @param string		The path to the file relative to the models dir
 * @param string		The database connection to use
 * @return object
 */
function &Model($model, $db_conn = '')
{
    static $models = array();
    // already loaded?
    if (isset($models[$model])) {
        return $models[$model];
    }
    if (!class_exists('Model')) {
        load_class('Model', 'core');
    }
    if (!Finder::load_file($model, 'models', false)) {
        show_error('Unable to locate the model you have specified: ' . $model);
    }
    if (($p = strrpos($model, '/')) !== false) {
        $model = substr($model, $p + 1);
    }
    //	$model .= '_Model';
    $models[$model] = new $model();
    // load the database
    if ($db_conn !== false) {
        $models[$model]->db = Lib('loader')->database($db_conn === true ? '' : $db_conn, true);
    }
    // reference other libs
    //	$models[$model]->_assign_libraries();
    return $models[$model];
}