In config.php
$config['base_url'] = 'http://localhost/codeigniter/';
In View
<link rel="stylesheet" href="<?php base_url(); ?>css/default.css" type="text/css" />
=> Error: Call to undefined function base_url();
Help me
In config.php
$config['base_url'] = 'http://localhost/codeigniter/';
In View
<link rel="stylesheet" href="<?php base_url(); ?>css/default.css" type="text/css" />
=> Error: Call to undefined function base_url();
Help me
To use base_url()
(shorthand), you have to load the URL Helper
first
$this->load->helper('url');
Or you can autoload it by changing application/config/autoload.php
Or just use
$this->config->base_url();
Same applies to site_url()
.
Also I can see you are missing echo
(though its not your current problem), use the code below to solve the problem
<link rel="stylesheet" href="<?php echo base_url(); ?>css/default.css" type="text/css" />