Welcome Guest, Not a member yet? Register   Sign In
Call to undefined function base_url() in the error_404 page
#1

(This post was last modified: 04-02-2015, 01:05 PM by jhonatan4878. Edit Reason: Mor information about the error )

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/s...rap.min.cs
Reply
#2

add url helper to autoloader
Reply
#3

(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.
Reply
#4

I am also having the same issue.
Reply
#5

(04-02-2015, 12:54 PM)jhonatan4878 Wrote:
(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.

Manually load the url_helper.php inside the error_404.php file:

PHP Code:
require_once BASEPATH '/helpers/url_helper.php'
Reply




Theme © iAndrew 2016 - Forum software by © MyBB