title: Codeigniter header and footer include
body: <p>I'm trying to move from AngularJS to PHP Model-View-Controler framework and something doesn't stick to me, because I do to much repeating. In angular you can do simple include of footer and header and all magic happens in view depending od the route. But in Codeiginiter for every view you need to include header and footer. Is there any good practice in which you don't have to do the much repeating    </p>
  
  <p><strong>In angularjs i have simple.</strong></p>
  
  <pre><code>    &lt;div ng-include='"templates/header.html"'&gt;&lt;/div&gt;
      &lt;div ng-view&gt;&lt;/div&gt;
      &lt;div ng-include='"templates/footer.html"'&gt;&lt;/div&gt;
  </code></pre>
  
  <p><strong>And this is routing</strong></p>
  
  <pre><code> .when("/", {
          templateUrl: "partials/home.html",
          controller: "PageCtrl"   
      })
      // Pages
      .when("/home", {
          templateUrl: "partials/home.html",
          controller: "PageCtrl",
      })
      .when("/about", {
          templateUrl: "partials/about.html",
           controller: "PageCtrl"
      })
  </code></pre>
  
  <p><strong>And this is how is done in CodeIgniter</strong> </p>
  
  <pre><code>     public function home(){ 
      $this-&gt;load-&gt;view('templates/header');
      $this-&gt;load-&gt;view('about');
      $this-&gt;load-&gt;view('templates/footer');
      }
     public function about(){ 
      $this-&gt;load-&gt;view('templates/header');
      $this-&gt;load-&gt;view('index');
      $this-&gt;load-&gt;view('templates/footer');
      }
  </code></pre>