CodeIgniter Forums
Loading a helper on error_404.php - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Loading a helper on error_404.php (/showthread.php?tid=35636)



Loading a helper on error_404.php - El Forum - 11-05-2010

[eluser]William Rufino[/eluser]
Is it possible to load a hepler into the 404 error page?
I tried this way <?php $CI =& get_instance();
$CI->load->helper('url');?>

but it doesn't work :/


Loading a helper on error_404.php - El Forum - 11-05-2010

[eluser]tonanbarbarian[/eluser]
the issue is that in a lot of cases (most actually) the controller is not loaded when the 404 error is processed
this is because CI processes the route to determine the controller to load. if the router is unable to determine a controller it goes to 404

however this is nothing stopping you from loading the helper in other ways
you can determine the path to the helper yourself and include it
looking in the system/libraries/Loader.php for the helper method will give you some ideas as to the paths you need to check and or include to load a helper


Loading a helper on error_404.php - El Forum - 11-05-2010

[eluser]William Rufino[/eluser]
Oh ok! I did it that way, but i thought could be a CI way to do it hhe! thx