title: How to load page views like header, sidebar, footer in CodeIgniter?
body: <p>Im trying to create my second web application in CodeIgniter.</p>
  
  <p>In my previous project I created views for page header, footer and sidebar.</p>
  
  <p>In every page controller I had to load these views like this:</p>
  
  <pre><code>class Home extends CI_Controller {
  
      public function index()
      {
          $this-&gt;load-&gt;view('header');
          $this-&gt;load-&gt;view('sidebar');
          $this-&gt;load-&gt;view('home'); // home
          $this-&gt;load-&gt;view('footer');
      }
  
      public function about()
      {
          $this-&gt;load-&gt;view('header');
          $this-&gt;load-&gt;view('sidebar');
          $this-&gt;load-&gt;view('about'); // about
          $this-&gt;load-&gt;view('footer');
      }
  
      public function contact()
      {
          $this-&gt;load-&gt;view('header');
          $this-&gt;load-&gt;view('sidebar');
          $this-&gt;load-&gt;view('contact'); // contact
          $this-&gt;load-&gt;view('footer');
      }
  }
  </code></pre>
  
  <p>I don't like this and I feel im doing it wrong.</p>
  
  <p>Any suggestions?</p>