undefined function base_url() - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: undefined function base_url() (/showthread.php?tid=4231) |
undefined function base_url() - El Forum - 11-14-2007 [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'); Code: <a href='<? echo base_url();?>index.php/mainpage'>Main Page</a> same thing when i use anchor. undefined function base_url() - El Forum - 11-14-2007 [eluser]gtech[/eluser] works for me! you get that error if the url helper hasn't loaded successfully; if you just put: Code: <? echo base_url();?> do you get the same problem, if so maybe you could try autoloading the helper. config/autoload.php Code: $autoload['helper'] = array('url', 'form'); undefined function base_url() - El Forum - 11-14-2007 [eluser]ELRafael[/eluser] just to check, your php.ini allows short tags open? <? and <?php ??? undefined function base_url() - El Forum - 11-14-2007 [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 <?php echo base_url();?> with short tags disabled or when short tags are enabled, you can use <?=base_url();?>. undefined function base_url() - El Forum - 10-02-2008 [eluser]alaminx[/eluser] get base url $base_url=$this->config->item(base_url); |