I have 4 pages in view such as
layout/header.php,
layout/header_assets.php,
user/main.php,
layout/footer.php
i want to load these multiple
For your Question
In Controller
$this->load->view('layout/header_assets',$data); # Change
$this->load->view('user/main',$data);
$this->load->view('layout/footer');
Best option is
A file should contain 3 part.
In Header
There is only contain
All CSS and JS
<html lang="en">
<head>
<meta>....
<link href="">....
<script>....
</head>
In Body
This should contain page displaying part and all codes. This contain
<body>
tag start ....In Footer
This should contain
</body>
tag close with </html>
So you can load this three View in codeigniter by
$this->load->view('layout/header');
$this->load->view('user/main',$data);
$this->load->view('layout/footer')
You can create a folder includes
under view
and create a page template
and add the below code in page template
-
<?php $this->load->view('includes/header');
$this->load->view($middle);
$this->load->view('includes/footer');
?>
And in your controller you can just call the template and pass your data like below-
$this->data['middle'] = 'public/existing_mem'; // view page to be included
$this->load->view('includes/template',$this->data);