2016-04-19 69 views
0
所有其他視圖

我的控制器是如何包括頭部視圖到笨

function loginProcess() 
{ 
    $this->db->select('moduleId'); 
    $this->db->from('roleaccess'); 
    $this->db->where('userId',$session_data['userId']); 
    $query=$this->db->get(); 
    $access=$query->row_array(); 
    $variable=implode(",",$access); 
    $query = $this->db->query("SELECT moduleName,moduleUrl FROM module where moduleId in($variable)"); 
    $resultdata['results'] = $query->result_array(); 
    $responce=$tst+$resultdata; 
    $this->load->view('admin/users1',$responce); 
} 
function user() 
{ 

    //set table id in table open tag 
    $tmpl = array ('table_open' => '<table id="big_table" border="1" cellpadding="2" cellspacing="1" class="mytable" style="border-collapse: collapse; ">'); 
    $this->table->set_template($tmpl); 
    $this->table->set_heading('Id','Email','UserName','View','Delete'); 
    $this->load->view('subscriber_view'); 

} 

我認爲subscriber_view我包括用戶1視圖如下

<?php 
    include("admin/users1.php"); 
?> 

,但它示出了未定義的變量結果error.how我包括包括(「admin/users1.php」)在所有其他views.please幫我

回答

0
function user() 
{ 

    //set table id in table open tag 
    $tmpl = array ('table_open' => '<table id="big_table" border="1" cellpadding="2" cellspacing="1" class="mytable" style="border-collapse: collapse; ">'); 
    $this->table->set_template($tmpl); 
    $this->table->set_heading('Id','Email','UserName','View','Delete'); 
    $this->loginProcess(); 
    $this->load->view('subscriber_view'); 

} 

che CK這一點...你可以添加以前的控制器,它呼籲與數據庫中的數據的標題,它將這個控制器還:)

0

您可以包括文件作爲

function loginProcess() 
{ 
    $this->db->select('moduleId'); 
    $this->db->from('roleaccess'); 
    $this->db->where('userId',$session_data['userId']); 
    $query=$this->db->get(); 
    $access=$query->row_array(); 
    $variable=implode(",",$access); 
    $query = $this->db->query("SELECT moduleName,moduleUrl FROM module where moduleId in($variable)"); 
    $resultdata['results'] = $query->result_array(); 
    $responce=$tst+$resultdata; 
    // loading header before page 
    $this->load->view('admin/header'); 
    $this->load->view('admin/users1',$responce); 
} 
function user() 
{ 
    //set table id in table open tag 
    $tmpl = array ('table_open' => '<table id="big_table" border="1" cellpadding="2" cellspacing="1" class="mytable" style="border-collapse: collapse; ">'); 
$this->table->set_template($tmpl); 
$this->table->set_heading('Id','Email','UserName','View','Delete'); 
//header 
$this->load->view('header'); 
$this->load->view('subscriber_view'); 
} 

或上工作您所有視圖文件的頂部寫入以下代碼

<?php 
    $this->load->view('header'); 
?>