Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] 404 Page Controller
#3

[eluser]louis w[/eluser]
Here is what I am using to achieve this. Pretty straight forward. Just check to make sure the CI object is around, and if so set a variable and call it just like you would with $this->

Don't use this for error_general, it requires some additional checking to make sure there are not recursive errors.


errors/error_404.php
Code:
<?php header("HTTP/1.1 404 Not Found");

if (function_exists('get_instance')) {

    $CI= &get;_instance();
    
    $content     = '<div class="error_message">'
                . '<h1>'.$heading.'</h1>'
                . $message
                . '</div>';
    
    // This is my own output wrapper/templating class. You could pass to a view instead.    
    $CI->output->showData($content);

} else {


    /*
        OLD WAY. Use this if there is not an instance of CI
    */
    
    
    ?&gt;
    &lt;html&gt;
    &lt;head&gt;
    &lt;title&gt;404 Page Not Found&lt;/title&gt;
    &lt;style type="text/css"&gt;
    
    body {
    background-color:    #fff;
    margin:                40px;
    font-family:        Lucida Grande, Verdana, Sans-serif;
    font-size:            12px;
    color:                #000;
    }
    
    #content  {
    border:                #999 1px solid;
    background-color:    #fff;
    padding:            20px 20px 12px 20px;
    }
    
    h1 {
    font-weight:        normal;
    font-size:            14px;
    color:                #990000;
    margin:             0 0 4px 0;
    }
    &lt;/style&gt;
    &lt;/head&gt;
    &lt;body&gt;
        <div id="content">
            <h1>&lt;?php echo $heading; ?&gt;</h1>
            &lt;?php echo $message; ?&gt;
        </div>
    &lt;/body&gt;
    &lt;/html&gt;
    
&lt;? } ?&gt;


Messages In This Thread
[SOLVED] 404 Page Controller - by El Forum - 03-22-2009, 06:22 PM
[SOLVED] 404 Page Controller - by El Forum - 03-23-2009, 03:04 AM
[SOLVED] 404 Page Controller - by El Forum - 03-23-2009, 01:22 PM
[SOLVED] 404 Page Controller - by El Forum - 04-12-2009, 06:58 PM
[SOLVED] 404 Page Controller - by El Forum - 05-15-2009, 05:56 AM
[SOLVED] 404 Page Controller - by El Forum - 05-15-2009, 11:19 AM
[SOLVED] 404 Page Controller - by El Forum - 05-16-2009, 01:13 PM
[SOLVED] 404 Page Controller - by El Forum - 05-17-2009, 11:11 PM
[SOLVED] 404 Page Controller - by El Forum - 01-15-2010, 06:16 AM



Theme © iAndrew 2016 - Forum software by © MyBB