[eluser]codex[/eluser]
Hey wire, I need some help here.
I love ME, but I think I may be using it the wrong way. Let's say I have a blog module, I first create the main controller that loads the view (just an example):
Code:
class Blog_controller extends MY_Controller {
// ========================================================================
function Blog_controller()
{
parent::MY_Controller();
}
function show_blog()
{
$template['content'] = $this->load->view('blog/show_blog', '', true);
$this->load->view('layout/main_template', $template);
}
}
The 'showBlog'view holds the module_run code:
Code:
<?=modules::run('blog_module', '', 'showBlog')?>
In modules/controllers I create another controller:
Code:
class Blog_module extends Module {
// ========================================================================
function Blog_module()
{
parent::Module();
}
function showBlog()
{
$this->load->model('blog_model');
$data['blog_items'] = $this->blog_model->getBlogItems();
return $this->load->view('list_blog_items', $data, TRUE);
}
In modules/views I create 'list_blog_items'-view, which presents the final data.
Is that correct?
Would it be possible to call the module directly from the url (or make it do that), surpassing the need to create a controller and view?