CodeIgniter Forums
base_url () problem - 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: base_url () problem (/showthread.php?tid=24764)



base_url () problem - El Forum - 11-19-2009

[eluser]shinokada[/eluser]
Beginner's question.

I added
Code:
echo '1. Basepath: ' . BASEPATH . "<br />\n";
echo '2. Apppath: ' . APPPATH . "<br />\n";
echo '3. Ext: ' . EXT . "<br />\n" ;
echo '4. Fcpath: ' . FCPATH ."<br />\n" ;
echo '5. Self: ' . SELF ."<br />\n" ;
echo '6. base_url(): ' . base_url() . "<br />\n";
in a view file to check base_url().

However I get the following with an error at the end.

1. Basepath: /home/1/mywebsite/www/ci/system/
2. Apppath: /home/1/o/mywebsite/www/ci/system/application/
3. Ext: .php
4. Fcpath: /home/1/o/mywebsite/www/ci/
5. Self: index.php

Fatal error: Call to undefined function base_url() in /home/1/o/mywebsite/www/ci/system/application/views/welcome_message.php on line 53

I changed URI PROTOCOL as suggested in config.php. But it does not fix the problem.

'AUTO','PATH_INFO', 'QUERY_STRING', 'REQUEST_URI', 'ORIG_PATH_INFO'

I also changed config.php,

$config['base_url'] = "http://localhost/ci/";
and
$config['base_url'] = "http://www.mywebsite.com/ci/";

But neither works.

Could anyone help me out and tell me what's wrong here?

Thanks in advance.


base_url () problem - El Forum - 11-19-2009

[eluser]Crimp[/eluser]
Did you remember to:

Code:
$this->load->helper('url');

Commonly autoloaded in applications due to frequent use.


base_url () problem - El Forum - 11-19-2009

[eluser]shinokada[/eluser]
Oooooops.

Thanks.