I am having an issue with loading a view inside a div.
The view alone loads well, but it appears blank while loading inside the div.
partial view ---> div in a main view
Structure
Controller main view
public function main_view(){
$data['page']="";
$this->load->view('layouts/header');
$data['accordion'] = $this->load->view('layouts/partial_view', '', TRUE);
$this->load->view('site/main_view',$data);
$this->load->view('layouts/footer');
}
Controller partial view
public function getFileType() {
$user_id = $this->session->userdata('id');
$this->load->model('portfolio_model');
$data['portfolio']=$this->portfolio_model->get_file_type($user_id);
$this->load->view('layouts/partial_view',$data);
}
Portfolio model
function get_file_type() { .... }
Main_view
<div>
<?php echo $accordion; ?>
</div>
Partial view
<?php if($this->session->userdata('id')) {
if(isset($portfolio) && !empty($portfolio)) { ?>
**** other view html **** <?php } } ?>
The reason was the data wasn't passing to the partial view. So, I put everything in the main view.
Controller main view
public function main_view(){
$data['page']="";
$this->load->model('portfolio_model');
$data['portfolio']=$this->portfolio_model->get_file_type($user_id);
$this->load->view('layouts/header');
//$data['accordion'] = $this->load->view('layouts/partial_view', '', TRUE); **** removed ****
$this->load->view('site/main_view',$data);
$this->load->view('layouts/footer');
}
Partial view controller deleted
And view content from 'partial view' is put into 'main view' , into the 'div' where i wanted it.
<div> html and php content from the partial view </div>