Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Call to undefined function anchor() in

Hi everyone I am new to a PHP framework codeIgniter, I am going over the user guide iv ran in to a problem, I am on the part where you load helper file but for some reason my code just in not working I keep getting this error:

Fatal error: Call to undefined function anchor() in /home/fresherd/public_html/CI/system/application/views/blogview.php on line 17

now im not 100% sure that it is loading the helper file this could be causing the but I am not sure how to detect the file has been loaded

any advice will help many thanks, Alan

like image 919
AlanMorton2.0 Avatar asked Aug 17 '26 04:08

AlanMorton2.0


2 Answers

If you are not sure please check the autoload.php file in the config folder or in your controller put the following function:

<?php
    function __construct(){
        parent::__construct();
        $this->load->helper('url'); 
    }
?>
like image 178
Nil'z Avatar answered Aug 18 '26 17:08

Nil'z


Just add url in helper inside autoload.php inside config folder.

$autoload['helper'] = array('url');

or you can add this inside your function

 $this->load->helper('url');
like image 34
Shivam Avatar answered Aug 18 '26 18:08

Shivam



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!