Pass argument to model constructor while loading a model |
*Alternatively* Here is another option, I feel as though the above is complicated when it can be something more simple.
/system/core/Loader.php PHP Code: public function model($model, $name = '', $db_conn = FALSE) replace with PHP Code: public function model($model, $name = '', $db_conn = FALSE, $params = array()) then where the model is being loaded, PHP Code: $CI->$name = new $model(); replace with PHP Code: if (isset($params) && !empty($params)) { |
Messages In This Thread |
Pass argument to model constructor while loading a model - by idealcastle - 01-13-2015, 09:31 AM
RE: pass argument to model constructor while loading a model - by idealcastle - 01-13-2015, 10:12 AM
|