title: CodeIgniter - get error messages
body: <p>I created my own custom error page by changing the line in config.php</p>
  
  <pre><code>$route['404_override'] = 'main/_404';
  </code></pre>
  
  <p>So now it loads the correct page, by loading the _404 function in my controller</p>
  
  <p>The issue is, I still want to be able to get a hold of the $heading &amp; $message error variables displayed in the default page, which show up as:</p>
  
  <pre><code>&lt;div id="container"&gt;
      &lt;h1&gt;&lt;?php echo $heading; ?&gt;&lt;/h1&gt;
      &lt;?php echo $message; ?&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Here's my _404 function if anyone can give me some advice how to add those variables I would greatly appreciate it</p>
  
  <pre><code>public function _404() {
          $data['query'] = array('title' =&gt; 'Page not found.', 'keywords' =&gt; '', 'description' =&gt; 'Page not found', 'page' =&gt; 'error');
  
  
          $this-&gt;load-&gt;view('parts/head',$data);
          $this-&gt;load-&gt;view('parts/_404');// &lt;- would go here
          $this-&gt;load-&gt;view('parts/footer');
      }
  </code></pre>