-
Notifications
You must be signed in to change notification settings - Fork 0
Modular Extensions FAQ
[b]Q: What does the abbreviation ME stand for?[/b] [b]A:[/b] In forum threads and the wiki ME is used as a abbreviation for Modular Extensions.
[b]Q: How can I load a module from within a view?[/b] [b]A:[/b] Put the following line in your view file
[code] <?php echo modules::run('module/controller/method') ?> [/code]
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: [code] <?php class Blog extends Controller {
function blog()
{
parent::Controller();
}
function blog_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.
}
} [/code]
[b]Q: How can I load a model in a controller of a module?[/b] [b]A:[/b] Take the following code as an example:
[code] // Loading a model $this->load->model('mymodelname'); // Using a model $this->mymodelname->function(); [/code]
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)