Call to undefined function base_url() in the error_404 page - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Best Practices (https://forum.codeigniter.com/forumdisplay.php?fid=12) +--- Thread: Call to undefined function base_url() in the error_404 page (/showthread.php?tid=1694) |
Call to undefined function base_url() in the error_404 page - jhonatan4878 - 04-02-2015 I'm starting with the version 3.0.0 of Codeigniter. One of the new features the manual defines that the error pages now is in the folder "view". My intention was: customising the 404 error to use both localhost and the site. However, when I try to call the funciton base_url() in my error_404.php, I receive this message: "Call to undefined function base_url()"; How can I call the funcions of the helper Url in the error pages by default? Do I need to create a Controller to do it? When I call the function show_404(); it works. For instance: http://www.jhonatanoliveira.com.br/a (if I inform the letter 'a', the Controller calls the show_404() function. Obs: I've modified the routes.php to allow it). But in an incorrect url, an error appears: For instance: http://www.jhonatanoliveira.com.br/css/site/bootstrap.min.cs RE: Call to undefined function base_url() in the error_404 page - gadelat - 04-02-2015 add url helper to autoloader RE: Call to undefined function base_url() in the error_404 page - jhonatan4878 - 04-02-2015 (04-02-2015, 12:31 PM)gadelat Wrote: add url helper to autoloader By default I've set my autoloader with the url helper. The base_url() function works with views in other folders, but in the html one don't. RE: Call to undefined function base_url() in the error_404 page - karthik_code - 07-24-2015 I am also having the same issue. RE: Call to undefined function base_url() in the error_404 page - pdthinh - 07-24-2015 (04-02-2015, 12:54 PM)jhonatan4878 Wrote:(04-02-2015, 12:31 PM)gadelat Wrote: add url helper to autoloader Manually load the url_helper.php inside the error_404.php file: PHP Code: require_once BASEPATH . '/helpers/url_helper.php'; |