我正在使用 codeigniter 我在我的[HOME]控制器中有这个BuildTemplate 函数来验证用户身份。我有另一个名为[AJAXCONT]的控制器,它有一个名为search()的函数,它返回数据以在视图中填充我的搜索表。我想在生成 $top_bar_data 视图后立即从它的搜索功能中检索该控制器的数据。我该如何编码。我的方法在这里正确吗?
private function BuildTemplate($view, $data) {
if($this->session->userdata('logged_in_faculty'))
{
$session_data = $this->session->userdata('logged_in_faculty');
$top_bar_data['Firstname'] = $session_data['Firstname'];
$top_bar_data['Lastname'] = $session_data['Lastname'];
$master_data['f_top_bar'] = $this->load->view('f_top_bar', $top_bar_data, true);
//I WANT TO RETURN ALL DATA IN THE AjaxCont controller returned by the search function HERE //
//$search_data = (all data from my search function in AJAXCONT controller )
// $master_data['search_results'] = $this->load->view('search_results', $search_data, true);
}
else
{
//If no session, redirect to login page
redirect('login', 'refresh');
}
return $this->load->view('master', $master_data, true);
}