Skip to content

Modular Extensions FAQ

World Wide Web Server edited this page Jul 4, 2012 · 22 revisions

Category:Library::HMVC

[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)

Clone this wiki locally