我正在使用HMVC和CodeIgniter。控制器中的变量未发送到CodeIgniter中查看
我有这个在我的testmodule控制器:
public function index()
{
$this->view_data['main_content'] = 'frontpage';
$this->load->view('template', $this->view_data);
}
而这是由这个控制器中加载该控制器的我的观点的template.php:
<?php
$this->load->view('includes/header');
$this->load->view($main_content);
$this->load->view('includes/footer');
?>
,但是,当我的var_dump( $ main_content)在视图和die()中显示null而不是首页
怎么回事?我一点都不明白。
我不事有什么不对的代码。问题一定在其他地方。 – Mischa 2013-02-25 11:52:35
我已经通过chnging $ this-> view_data将其解析为$ view_data并突然生效。但是,我不知道为什么。你知道为什么吗? – Derfder 2013-02-25 11:56:48