title: codeigniter viewpage showing output before <html> tag
body: <p>I have an php application in Codeigniter. There are 3 pages model.php , controller.php and view.php</p>
  
  <p>model.php    </p>
  
  <pre><code>&lt;?php
      class Activity_insert extends CI_Model {
          public function  activity()
          {
              echo "it works";
          }
      }
      ?&gt;
  </code></pre>
  
  <p>controller.php</p>
  
  <pre><code>public function viewemp($q = NULL)
           {
              $this-&gt;load-&gt;helper('form');
              $this-&gt;load-&gt;library('form_validation');
                  $this-&gt;load-&gt;model('activity_insert');
               $data['activity_log'] = $this-&gt;activity_insert-&gt;activity();
                  $this-&gt;load-&gt;view('header');
                  $this-&gt;load-&gt;view('sidebar');
                  $this-&gt;load-&gt;view('success',$data);
                  $this-&gt;load-&gt;view('footer');
           }
  </code></pre>
  
  <p>view.php</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&gt;
      &lt;title&gt;GATT&lt;/title&gt;
    &lt;/head&gt;
    &lt;body class="hold-transition skin-blue sidebar-mini"&gt;
      &lt;div class="wrapper"&gt;
  
      &lt;/div&gt;
    &lt;/body&gt;
    &lt;/html&gt;
  </code></pre>
  
  <p>after compiling my view page ahowing like this</p>
  
  <pre><code> it works &lt;!DOCTYPE html&gt;
      &lt;html&gt;
        &lt;head&gt;
          &lt;meta charset="utf-8"&gt;
          &lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&gt;
          &lt;title&gt;GATT&lt;/title&gt;
        &lt;/head&gt;
        &lt;body class="hold-transition skin-blue sidebar-mini"&gt;
          &lt;div class="wrapper"&gt;
  
          &lt;/div&gt;
        &lt;/body&gt;
        &lt;/html&gt;
  </code></pre>
  
  <p>data is coming at starting of page. and if I did not call $activity_log anywhere in view.php it still showing same text "it works" at very begining of page. please help to resolve it.</p>