Vheissu / Ci-Smarty

Smarty templating engine integration for Codeigniter 3.0+ with inbuilt theming and asset management.
http://ilikekillnerds.com
179 stars 43 forks source link

Using "fetch" with HMVC #32

Closed candfe closed 10 years ago

candfe commented 10 years ago

I have one module fetching the view, like:

class News extends MX_Controller {

public function index() {
    $this->parser->parse('news.tpl');
}

public function html() {
    return $this->parser->fetch('news.tpl');
}

}

But when I call it from a different module controller, it says news.tpl cannot be found !!!

class Page_Main extends MX_Controller {

public function index() {

    $data['title'] = 'Main Page';                
    $data['main'] = Modules::run('news/html');

    $this->parser->parse('page_main.tpl', $data);
}

}

candfe commented 10 years ago

Just figured out a way to use the .tpl view as data with:

return $this->parser->parse('news.tpl', '', TRUE);