not showing view page correctly - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: not showing view page correctly (/showthread.php?tid=54600) |
not showing view page correctly - El Forum - 09-16-2012 [eluser]xtremer360[/eluser] 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. http://pastebin.com/Hc8fDh8k What I want it to look like: http://screencast.com/t/f8shdI9f What it actually looks like: http://screencast.com/t/JH0shwfnpk not showing view page correctly - El Forum - 09-16-2012 [eluser]PhilTem[/eluser] 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: Code: $route['404_override'] = 'errorpage'; not showing view page correctly - El Forum - 09-16-2012 [eluser]xtremer360[/eluser] 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? not showing view page correctly - El Forum - 09-16-2012 [eluser]xtremer360[/eluser] Any other ideas? not showing view page correctly - El Forum - 09-17-2012 [eluser]CroNiX[/eluser] 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. not showing view page correctly - El Forum - 09-17-2012 [eluser]swgj19[/eluser] 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) redirect(view); not showing view page correctly - El Forum - 09-17-2012 [eluser]CroNiX[/eluser] 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. not showing view page correctly - El Forum - 09-17-2012 [eluser]swgj19[/eluser] 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/ Thanks. not showing view page correctly - El Forum - 09-18-2012 [eluser]xtremer360[/eluser] Only problem is that I have a themes and template systems set up so it would look different. Still having issues with this. |