Welcome Guest, Not a member yet? Register   Sign In
My view duplicate in the page
#1

[eluser]SamoualSys[/eluser]
iam using standered Ci with Auth_ion when i pass the data from my controller to the view it show me my data twice one in the above header and one inside my template this the code that i use
Code:
public function report_all()
  {
  $this->data['title'] = "report all";
       $config = array();
    $data=array();
      $config["base_url"] = base_url()."report/report_all";
        $config["total_rows"] = $this->mod_model->record_count();
        $config["per_page"] = 10;
          $config["uri_segment"] = 3;
        $this->pagination->initialize($config);
      $page = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;
     $data["results"] = $this->mod_model->display_report($config["per_page"], $page);
         $data["links"] = $this->pagination->create_links();
       $this->load->view("report/report_all", $data);
  
    $this->render();
  
}

i now that that happen becouse i load the view but how can i pass this data without loading the view the view is loading twice as i said one in its correct place and the other one wrong i have creat folder for the view with the name of the controller and the view page in the name of the function and that one is the correct one and the other its loade it becouse i said
Code:
$this->load->view("report/report_all", $data);
can any one help me to just pass the data .
#2

[eluser]SamoualSys[/eluser]
I have found that there is third parameter can be used in the load view and its default value is false so you have to set it as true and its common in template .
the code of the view will look like that
Code:
$this->load->view("report/report_all", $data,true);
it will load the view in the template you design .
enjoy CI




Theme © iAndrew 2016 - Forum software by © MyBB