• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
not showing view page correctly

The problem is that if a page is visited to where the url looks like mysite.com/newscategories/edit/5 if 5 isn't a row created in the database yet meaning it wouldn't have any data then it needs to show the 404 error page I have set up. Not sure why its not with line 103 of the pastebin. It works when there isn't an integer added to the url or if its not even a value numerical value for the id.


What I want it to look like:


What it actually looks like:


Because CI's show_404() returns a standard 404-error page unless you have a special page configured in ./application/config/routes.php

In your case it should be:
$route['404_override'] = 'errorpage';

That is how I have it setup because I remembered to do that. Is there any other possibilities as to why this could be occuring?

Any other ideas?

show_404() doesn't trigger the custom error controller as far as I know. You can always just style the /application/errors/error_404.php template to be the same as your custom controller since you don't have any dynamic data showing.

I understand what you mean. I am trying to find a solution for this to right now. Say you have a blog and someone changes the article number in the address in the url, if no row exist according to the query, then there is an error that will show.

I think the solution needs to be a conditional statement

if (id does not exist)


It depends. If it's something in a backend it doesn't matter. But if it's for a public page, like someone typed http://yoursite.com/abouts instead of /about, you don't want the url to change with a redirect and you want to issue a proper 404 header to inform search engines that the requested page does not exist.

Makes sense. Good point on the search engines and proper 404. If you have time, can you look at http://ellislab.com/forums/viewthread/224478/

Only problem is that I have a themes and template systems set up so it would look different. Still having issues with this.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.