You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You may return a value as the output of a module controller or you can output a view or simply use echo, because the output is buffered and returned it can be used as needed.
Example:
<?php
class Blog extends Controller {
functionBlog()
{
parent::Controller();
}
functionblog_read($id)
{
$data['title'] = 'Title '. $id;
$this->load->view('blog_read',$data); //return is NOT required for views.echo$some_data; //echo CAN be used if needed.
}
}
Q: How can I load a model in a controller of a module?A: Take the following code as an example:
// Loading a model$this->load->model('mymodelname');
// Using a model$this->mymodelname->function();
mymodelname = The name of the model you want to load.
function = The function of the model you want to use.
The model can be stored in the application folder (system/application/models/mymodelname.php) or in the models subdirectory of a module (system/application/modules/mymodule/models/mymodelname.php)