Welcome Guest, Not a member yet? Register   Sign In
Loading model from variable?
#1

[eluser]debow[/eluser]
Is there a way to load a model from variable and call it throughout the controller.

IE:

controller/??.php

Code:
var $data = array(
        'title' => 'test',
    'model' => 'My_Model',
    );


$this->load->model('$model') //This doesnt work...is there a way around it.

The reason being is I have controllers I can copy/paste and the only different is the table they are calling and their name so instead of having to change the the model name thats used many times in the controller I want to just change it in one location on each controller.

Also want to call the model in this way as well.

Code:
$results = $this->$model->search($limit, $offset, $sort_by, $sort_order);

Thanks


Messages In This Thread
Loading model from variable? - by El Forum - 04-15-2011, 09:45 PM
Loading model from variable? - by El Forum - 04-15-2011, 11:49 PM
Loading model from variable? - by El Forum - 04-16-2011, 01:58 AM
Loading model from variable? - by El Forum - 04-16-2011, 02:10 AM
Loading model from variable? - by El Forum - 04-16-2011, 02:21 AM
Loading model from variable? - by El Forum - 04-16-2011, 03:40 AM
Loading model from variable? - by El Forum - 04-16-2011, 08:59 AM
Loading model from variable? - by El Forum - 04-16-2011, 09:10 AM
Loading model from variable? - by El Forum - 04-16-2011, 12:15 PM



Theme © iAndrew 2016 - Forum software by © MyBB