Trying to get 404 to work
HI, I have been using this for about 3 years. I have not upgraded much as I have too much invested in it. I have version .9.3.
The issue right now is say I have a site.com/test and test is not a controller and I want it to show a 404. I have the Opt-In working fine. If I set development mode it shows blank page obviously. Otherwise I get errors that it cant find a page to go to. I am sure it is something simple. I cant find where in the code it kicks it to a 404. 404 override is the page_router so the 404 never seems to get called even though test controller does not exist. test test1 whatever. I have custom error page I go to in my htaccess but that is for shtml that I catch. This will be for errors like I cant find a page or the controller. It errors out in the header:
Message: Undefined property: CI_Exceptions::$load
Filename: _blocks/header.php
I always know that means I dont have the view file set. In this case there is no controller correct or any view file matching it. I know I must have something simple to set. fuel_mode is cms.
Well let me know.. I think I have given enough info.
Comments
ok to clarify I have this at the top of my view files.
<?php fuel_set_var('layout', '')?>
<?php $this->load->view('_blocks/header')?>
Does it load main.php or nothing at all. Maybe none.php? Why is it trying to load a header if it can't find the controller? I load all the head and footer and content in the view file itself. But if I do not put that code above then the view page gets all jacked. I sometimes load different headers depending on my needs in the view file. I don't have php debugging setup as I really never need it but times like these. Well back to the question.. how to get a 404 to show?
if it helps this is how I load it from the controller but since it should not get to a controller I don't think this helps a lot.:
$vars['page_title'] = 'xxxxxx';
$this->load->module_library(FUEL_FOLDER, 'fuel_page', array('location' => 'xxxxxxxxx'));
$this->fuel_page->add_variables($vars);
$this->fuel_page->render();
Also, fuel_router exists in the "fuel/modules/fuel/controllers/fuel_router.php" file path (I mistakenly did not have "controllers" in the path above and have since updated).
Are you thinking of page_router.php? That exists.
Ok, yes that is the file.. I am seeing it is calling a 404.
It is happening in the show_error function.
include(APPPATH.'errors/'.$template.EXT);
When that runs it is causing it so I will hunt it down and see. Likely header is getting called as you said.
Yep, its the error_404.php file and whenit calls the header I have a lot in there like checking if they are logged in so now I can deal with it.. thanks. Appreciate your help.
I hope this helps someone else. I have done a huge amount on this CMS although I do not use the admin at all, I have made my own admin. Added roles and permissions and such and have run into similar issues but this one I could not figure it out.