I'm using a template library from Phil Sturgeon. I also use modules.
Module blog only works when I add
$this->template->set_theme('nvc');
$this->template->set_layout('theme');
But I don't want that, I want to set that in the core file. How should I fix this?
Module welcome works perfectly
class Welcome extends NVC_Controller {
function index()
{
$this->template->build('theme');
}
}
But module blog gives an error (template):
Unable to load the requested file: default.php
class Blog extends NVC_Controller {
var $num = 10;
function __construct()
{
$this->load->model('blog_model', 'blog');
}
function index()
{
$data["result"] = $this->blog->get_all_posts($this->num);
$this->template->build('blog', $data);
}
}
core/NVC_Controller.php
class NVC_Controller extends MX_Controller {
function __construct(){
if(nvc_site_open()){
$this->template->set_theme('nvc');
$this->template->set_layout('theme');
} else {
show_error("De site is momenteel gesloten.");
}
}
}
What is going wrong? Setting the config layout to "theme" also doesn't work.
The template is stored in application/themes/nvc/views/layouts/theme.php.