アプリケーションにヘッダーをインクルードしようとしています。コントローラーを作成し、データ変数をレンダリングするsite関数を定義しました。headerviews/header.php
ただし、myUrl/site/headerすべての変数にアクセスしようとすると正常に動作しますが、サイトコントローラーで別の関数を作成してそれindexに含めるviews/headerとsite/index、ヘッダーに未定義の変数通知が表示されます。
何か案が??
class site extends CI_Controller {
function header()
{
$data =array('name'=>'foo');
$this->load->view('includes/header',$data);
}
function index()
{
$this->load->view('includes/index');
}
}
INDEX.PHP
$this->load->view('includes/header');