Q:

create master page layout in codeigniter master-page layout

I am trying to create master page layout in conditioner.But problem is that .I am getting page load error .
I have Header.php ,footer.php ,sidebar.php
Dashboar_view.php page is this 
<?php include_once('common/header.php');?>
<div class="content-wrapper">
    <div class="container-fluid">
      <!-- Breadcrumbs-->
      <ol class="breadcrumb">
        <li class="breadcrumb-item">
          <a href="#">Dashboard</a>
        </li>
        <li class="breadcrumb-item active">My Dashboard</li>
      </ol>

      </div>
<!-- HERE WILL BE ALL PAGE DATA WILL BE SHOWN -->
  <?php $this->load->view($content); ?>
    </div>
    <!-- /.container-fluid-->
    <!-- /.content-wrapper-->
<?php require_once('common/footer.php');?>

And here is my controller function Dashboard.php
    public function viewchart()
    {
        $data = array('content'=>'viewchart');
        $this->load->view('admin/dashborad_view',$data);
    }

getting error 

Unable to load the requested file:  viewchart.php.

nay help regarding create dynamic master layout for page content load.
Thanks  

A:

Hope this will help you :
if charts_view.php is a file in view folder you want to show in your dashboard 
Your controller should be like this :
public function viewchart()
{
    $chart_content = $this->load->view('charts_view',TRUE);
    $data = array('chart_content'=> $chart_content);
    $this->load->view('admin/dashborad_view',$data);
}

Your view should be like this :
<?php include_once('common/header.php');?>
<div class="content-wrapper">
    <div class="container-fluid">
      <!-- Breadcrumbs-->
      <ol class="breadcrumb">
        <li class="breadcrumb-item">
          <a href="#">Dashboard</a>
        </li>
        <li class="breadcrumb-item active">My Dashboard</li>
      </ol>

      </div>
<!-- HERE WILL BE ALL PAGE DATA WILL BE SHOWN -->
  <?php echo $chart_content; ?>
    </div>

<?php require_once('common/footer.php');?>

for more : https://www.codeigniter.com/user_guide/general/views.html#returning-views-as-data

