sea_1987
sea_1987

Reputation: 2954

CodeIgniter template library problems

I am trying to use a template library with my current codeigniter project. However I am getting the following error message,

Unable to load the requested file: main.php

My file system looks like this,

 /application  
      /themes  
        /views  
          /layouts  
             admin.php

In MY_Controller.php I have the following,

<?php
class Dashboard extends MY_Controller {

    public function __construct()
    {
        parent::__construct();
    }
}
?>

In my controller I have the following

<?php
class Dashboard extends MY_Controller {

    public function __construct()
    {
        parent::__construct();
        //$this->template->set_layout('admin');
    }

    public function index()
    {
        $this->template
            ->set_layout('admin') // application/views/layouts/two_col.php
            ->build('welcome_message'); // views/welcome_message
    }
}

Upvotes: 1

Views: 1691

Answers (2)

John Mellor
John Mellor

Reputation: 2503

It depends what template system your using, from the sounds of it you're using Phil Sturgeon's template library.

If so open up config/template.php

and find this line:

$config['layout'] = 'main';

And edit it as applicable.

Upvotes: 1

Christophe
Christophe

Reputation: 4828

Which template system are you using? I guess it needs a file named main.php which will load the view. Or the file does not exist and you will have to add it or the path to the file is not correct

Upvotes: 0

Related Questions