Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6748783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:36:28+00:00 2026-05-26T12:36:28+00:00

I created my own custom error page by changing the line in config.php $route[‘404_override’]

  • 0

I created my own custom error page by changing the line in config.php

$route['404_override'] = 'main/_404';

So now it loads the correct page, by loading the _404 function in my controller

The issue is, I still want to be able to get a hold of the $heading & $message error variables displayed in the default page, which show up as:

<div id="container">
    <h1><?php echo $heading; ?></h1>
    <?php echo $message; ?>
</div>

Here’s my _404 function if anyone can give me some advice how to add those variables I would greatly appreciate it

public function _404() {
        $data['query'] = array('title' => 'Page not found.', 'keywords' => '', 'description' => 'Page not found', 'page' => 'error');


        $this->load->view('parts/head',$data);
        $this->load->view('parts/_404');// <- would go here
        $this->load->view('parts/footer');
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T12:36:29+00:00Added an answer on May 26, 2026 at 12:36 pm

    Well, actually, two things:

    1) In your re-routed 404 page, you should be able to pass regularly any variable you want, so you can simply $this->load->view('parts/_404',$data); and have there available your variables.

    2) if you’re talking about the default 404 page, keep in mind that it can’t be overridden under certain circustamces, that is when the show_404() core function is called:

    It won’t affect to the show_404() function, which will continue
    loading the default error_404.php file at
    application/errors/error_404.php.

    This function belongs to the Exception handler class. There, in fact, at line 90 you have

    function show_404($page = '', $log_error = TRUE)
        {
            $heading = "404 Page Not Found";
            $message = "The page you requested was not found.";
    
            // By default we log this, but allow a dev to skip it
            if ($log_error)
            {
                log_message('error', '404 Page Not Found --> '.$page);
            }
    
            echo $this->show_error($heading, $message, 'error_404', 404);
            exit;
        }
    

    which in turn calls the show_error() method wich sets the header error code (4th argument) and adds the specified view (3rd argument) to the view buffer.

    As you can see messages are here hardcoded inside the method. If you want a total customization you can either override this method (make it, for example, call another function within the same class) or simply hardcode other message there instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created my own custom date picker consisting of an ASP TextBox, Button, and
I have created a custom list view, each row has it's own custom selector,
I've created a custom keyboard with my own Unicode characters... The app works great
I've created a custom textInput componenet that handles it's own validation using a private
So, I'm trying to redirect to an error page in my own AuthorizeAttribute using
I have created my own custom role provider class SGI_RoleProvider and configured properly. Everything
I have created my own button class called custom_btn. I created it on the
How do you create your own custom component for vb.net 2008? I want it
Please help me create my own custom layout, container, component, layout manager... Example: Containers
I want to create my own custom collection type. I define my collection as:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.