CodeIgniter模板库问题
我正在尝试在我当前的 codeigniter 项目中使用模板库。但是我收到以下错误消息,
无法加载请求的文件:main.php
我的文件系统如下所示,
/application
/themes
/views
/layouts
admin.php
在 MY_Controller.php 中我有以下内容,
<?php
class Dashboard extends MY_Controller {
public function __construct()
{
parent::__construct();
}
}
?>
在我的控制器中我有以下内容
<?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
}
}
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
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这取决于您使用的模板系统,听起来您正在使用 Phil Sturgeon 的模板库。
如果是这样,请打开 config/template.php
并找到此行:
并根据需要进行编辑。
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:
And edit it as applicable.
您使用哪个模板系统?我想它需要一个名为 main.php 的文件来加载视图。或者该文件不存在,您必须添加它,或者文件的路径不正确
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