0
我使用smarty和ci 3.0.6我可以在我的核心中使用基礎控制器嗎?我這樣做,但我不,我認爲沒有任何價值如何在所有視圖中都有變量?
控制器:
class MY_Controller extends CI_Controller {
public $stats;
public $title;
public function __construct() {
parent::__construct();
$this->load->model('User_Model');
$var->stats = $this->User_Model->count_Unverified_adviser();
$t=$var->stats->Unverified;
$var->title = 'title';
$this->custom_smarty->assign('vars',$var);
$this->load->vars($var);
} }
我的控制器,加載視圖:
class Adviser extends MY_Controller {
function __construct()
{
parent::__construct();
$this->load->model('User_Model');
}
public function index()
{
$this->custom_smarty->assign('url',base_url());
$this->custom_smarty->display('test.tpl');
}
我test.tpl:
<td>{$vars.title}</td>
是否Smarty的顯示錯誤? – m13r