Reputation:
i am completely new to codeigniter, i have created a captcha using an online tutorial for my login form in codeigniter. i get the following error while loading my login page:
> Fatal error: Call to undefined function base_url() in
$config = array(
'img_path' => 'captcha_images/',
'img_url' => base_url().'captcha_images/',
'img_width' => '150',
'img_height' => 50,
'word_length' => 8,
'font_size' => 16
);
$captcha = create_captcha($config);
i dont have any folder named 'captcha_images', all i have is a controller for captcha,config and the view in login. As am new to this, is it because i dont have a folder or i didnt call any library? please help me with this. thanks in advance
Upvotes: 0
Views: 357
Reputation: 409
Go to
application/config/autoload.php
Write this line below (You will find codeigniter nice documentation at line 90)
$autoload['helper'] = array('url');
This will autoload url helper.
base_url() function is defined in url helper
You can manually load this for a particular controller
Wrire this line $this->load->helper('url');
Within controller constructor or
Controller action function
For more information about base_url click
Upvotes: 1