Welcome Guest, Not a member yet? Register   Sign In
undefined function base_url()
#1

[eluser]mistress_shiira[/eluser]
hi guys!kindly point out what im doing wrong here.cause i cant seem to understand why i keep getting this error.

in my controller i have a function add that calls the view below:
Code:
$this->load->helper('url');
$this->load->view('mainpage');
and in my view:
Code:
<a href='&lt;? echo base_url();?&gt;index.php/mainpage'>Main Page</a>
but then undefined function error is displayed.
same thing when i use anchor.
#2

[eluser]gtech[/eluser]
works for me! you get that error if the url helper hasn't loaded successfully;

if you just put:
Code:
&lt;? echo base_url();?&gt;

do you get the same problem, if so maybe you could try autoloading the helper.

config/autoload.php

Code:
$autoload['helper'] = array('url', 'form');
#3

[eluser]ELRafael[/eluser]
just to check, your php.ini allows short tags open?
&lt;? and &lt;?php ???
#4

[eluser]esra[/eluser]
If short tags are not enabled in php.ini and you cannot change php.ini, you can force short tags on using the last parameter in the config.php file. You should be using &lt;?php echo base_url();?&gt; with short tags disabled or when short tags are enabled, you can use &lt;?=base_url();?&gt;.
#5

[eluser]alaminx[/eluser]
get base url

$base_url=$this->config->item(base_url);




Theme © iAndrew 2016 - Forum software by © MyBB