Tazz Posted December 15, 2009 Share Posted December 15, 2009 Im a Kohana newbie. How and where do you make a custom 404 page for Kohana framework. I have read a few posts that give code but I am unable to get that going. Apparently you create a errors.php file in application\hooks\errors.php but its not working. Where in Kohana do you set a global path to a view for any 404 errors? Quote Link to comment https://forums.phpfreaks.com/topic/185210-how-to-make-404-page-for-kohana-framework/ Share on other sites More sharing options...
salathe Posted December 15, 2009 Share Posted December 15, 2009 Which version of Kohana are you using? Have you looked at the documentation and/or searched their forums before coming here? Quote Link to comment https://forums.phpfreaks.com/topic/185210-how-to-make-404-page-for-kohana-framework/#findComment-977981 Share on other sites More sharing options...
Tazz Posted December 17, 2009 Author Share Posted December 17, 2009 I have Googled it, as well as searched on the Kohana forums. All the code examples assume you know how the framework works inside-out. I am using version 2.3.4. All I need to know is just the path to the file where I can set a default controller/view for any 404 errors, if such a method exists in Kohana. Quote Link to comment https://forums.phpfreaks.com/topic/185210-how-to-make-404-page-for-kohana-framework/#findComment-978941 Share on other sites More sharing options...
Tazz Posted December 17, 2009 Author Share Posted December 17, 2009 I've figured out a way to redirect any 404 errors to a single controller. It's probably not the best way, but it works like a charm. Find system\libraries\Router.php If your file is still untouched, the code you want to add will be on line 162 Simply redirect to your 404 error controller. if (Router::$controller === NULL) { // No controller was found, so no page can be rendered url::redirect(url::site()."notfound"); exit; // Event::run('system.404'); } I'm sure you can figure out the rest from here... Quote Link to comment https://forums.phpfreaks.com/topic/185210-how-to-make-404-page-for-kohana-framework/#findComment-978991 Share on other sites More sharing options...
HGeneAnthony Posted December 24, 2009 Share Posted December 24, 2009 I'd switch off Kohana if I was you. I used to use it for years, however their documentation tends to be incomplete, they break old cold with new updates, and they don't offer downloadable documentation. It's also hard to find help with it because it's really not that popular. I switched to codeigniter and I've been happier with it. Quote Link to comment https://forums.phpfreaks.com/topic/185210-how-to-make-404-page-for-kohana-framework/#findComment-983474 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.