在application/core下新建一个MY_Controller.php ,代码如下:
<?php
class MY_controller extends CI_Controller
{
public function __construct()
{
parent::__construct();
}
public function assign($key, $val)
{
$this->ci_smarty->assign($key, $val);
}
public function display($html)
{
$this->ci_smarty->display($html);
}
}
在views下创建templates目录
在templates下新建一个测试模板test.tpl
hello.world
在controllers下新建一个测试文件Pages.php继承MY_controller
<?php
class Pages extends MY_controller {
public function index()
{
$this->display('test.tpl');
}
}