Welcome Guest, Not a member yet? Register   Sign In
Extending 'Exceptions' for referring 'get_instance()' CI 2.0
#1

[eluser]Sodavath[/eluser]
Hello there,

I have a question on how to extend 'Exceptions' to be able to refer to 'get_instance()' (using CI 2.0)

I only get errors when I try to extend it Undecided

I'm trying to access 'site_url()' so I can customize error pages with CSS but I need the relative path to it and maybe some more functions down the road

PS: So far the only working solution for me is this

I don't think it's very good/secure way to do that but it gets the job done to some extent

<b>Exceptions.php</b>
Code:
&lt;?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class MY_Exceptions extends CI_Exceptions {

    var $CN = '';

    function __construct() {
        parent::__construct();
        $this->CN =& get_config();
        $this->CN = $this->CN['base_url'];
    }

}
<b>error_404.php</b>
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
&lt;html &gt;
  &lt;head&gt;
    &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;
    &lt;title&gt;
      404 Page Not Found
    &lt;/title&gt;
    &lt;link rel="shortcut icon" href="&lt;?php echo $this-&gt;CN,APPPATH;?&gt;media/favicon.ico" />
    &lt;link rel="stylesheet" href="&lt;?php echo $this-&gt;CN,APPPATH;?&gt;media/style.css" type="text/css"/>
  &lt;/head&gt;
  &lt;body&gt;
    <div id="wrap">
        <div id="header">
      <h1><a >CN; ?&gt;">MY SITE</a></h1>
    </div>
      <div id="main">
        <div id="error">
            <h2>&lt;?php echo $heading; ?&gt;</h2>
            <p>&lt;?php echo $message; ?&gt;</p>
        </div>
      </div>
    </div>
    <div id="footer">
        BIGFOOT
    </div>
  &lt;/body&gt;
&lt;/html&gt;




Theme © iAndrew 2016 - Forum software by © MyBB