Hi, First off I am pretty new to this whole thing so feel free to tell me to bugger off.
I am trying to load the views for a set of 'modules' for a user who has selected any number of available 'modules'. I can get the name of the module (or any column) from the database and load->view($name . '_view'); but can't seem to figure a way to load the data for the view based on the 'module' name.
//Loads the rows (selected modules) I need for this user into an array
$modules['modulearr'] = $this->module_model->getModuleUser();
for($i = 0; $i < count($modules['modulearr']); $i++){
//Get the variable from the array
$name = $modules['modulearr'][$i]->mod_name;
//The below works.
$this->load->view($name.'_view');
//The below would not work. (this is the crux of my problem)
$data = $this->$name.'_model'->get();
$this->load->view($name.'_view', $data);
}
There is also an issue with loading the models in the controller based on the fact I can't change $this->load->THIS_PART dynamically.
I am new to everything so there may be a basic concept I am not grasping, If you could point me in the right direction that would be awesome. I could do a whole bunch of if statements but that seems messy, surely there is a better way.
Thanks.