I have already loaded the URL helper, I have set the base url in config, yet this code seems to gave me:
PHP Error was encountered
Severity: Error
Message: Call to undefined function base_url()
Filename: views/site_navigation.php
Line Number: 6
Here is line number six:
<li><a href="<?php echo base_url(); ?>/welcome">Home</a></li>
Basically one can use site_url() while creating links for controllers whereas base_url() can be used where we need to create urls for the assets like loading a css or js file or some image .
base_url() is the URL of your CodeIgniter root or the location of the index. php file along with a trailing slash appended to the end of the URL. If the domain name is example.com and the website is using HTTPS as well as www. Further, the index.
The base URL of the site can be configured in application/config/config. php file. It is URL to your CodeIgniter root. Typically, this will be your base URL, with a trailing slash e.g.
$config['base_url'] = "http://".$_SERVER['SERVER_NAME']."/mysite/"; This configuration will work in both localhost and server.
This error means only one thing that you did not load the url helper correctly. Please follow the documentation and load it as specified from your current action or from the constructor of your controller.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With