I want to have good pages with good search. For this I need to get some CSS and JS files. But for some odd reason, using base_url() doesn't work on error_pages. I could just use href="/css/style.css" and say to get it from the root folder. But the site may well be placed in a different folder than the root folder. Therefore, using / not an option.
So now my question is why base_url() not working on the error page? I automatically downloaded it so that it does not work?
This is what I tried when I tried to get base_url () from the error_404 page in the view.
In my autoload.php, I included a helper url
$autoload['helper'] = array('url', 'form');
And on my error_404 page (application / views / errors / html / error_404.php) I repeat base_url like this:
<?php echo base_url(); ?>
This is the error I get:
An uncaught Exception was encountered Type: Error Message: Call to undefined function base_url() Filename: /usr/local/www/example.com/application/views/errors/html/error_404.php Line Number: 37 Backtrace: File: /usr/local/www/example.com/index.php Line: 315 Function: require_once
I do not want to make changes to the system folder, since I do not want to repeat this process every time I update the Codeigniter folder.
System:
Codeigniter 3.0.6
PHP 7.0.8
Nginx 1.11.1
UPDATE: I would like to call base_url on every error page (db, 404, general, php, etc.).
source share