link_tag() not working in codeIgniter link_tag() not working in codeIgniter codeigniter codeigniter

link_tag() not working in codeIgniter


You first need to load this helper: $this->load->helper('html');

For the link_tag() to work, you need to load the HTML helper like this $this->load->helper('html');

so in your controller code, I would add it like this:

public function index() {    $this->load->helper('html');    $data['title'] = 'Welcome';    $this->load->view('home/index', $data); }


For adding $this->load->helper('html') in each function we can use $autoload['helper'] = array('html'); in application/config/autoload.php file


For using link_tag() you need to load html helper

You can load it using

$this->load->helper('html');

Then your code look like this

public function index() {$this->load->helper('html');$data['title'] = 'Welcome';$this->load->view('home/index', $data);

}