• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
base_url() -> empty

#1
[eluser]sl3dg3hamm3r[/eluser]
Hey there

I'm just trying to do my first simple project with code-igniter. Well, with every framework, at the beginning there is more pain than joy, but I'm positive this gonna change soon.

Here my problem (code in controller):

Code:
$this->load->helper('url');
        echo "base-url: " . base_url();

and in the config-file, on line 14, I certainly defined the variable:
Code:
$config['base_URL'] = "http://127.0.0.1/xyz/";

But I don't get any url, it would only show 'base-url:' in the browser. What could that be?

Oh, and right another question: since I expect to use the url-helper almost everywhere, is there a load-routin which is called for every called controller? So I might need to write it only once...

Sincerely
Oliver

#2
[eluser]andreagam[/eluser]
Oliver, I can answer to your second question...
just open the autoload.php file in the config folder and on line 54 write
Code:
$autoload['helper'] = array( 'url');
you can autoload helpers and libraries that you largely use in your application.
I can't see anything wrong in your base_url() code, may be some other config is missing...

#3
[eluser]Yash[/eluser]
For first Qs

first autoload url helper

In view file use this

Code:
echo "base-url: " . base_url();

and in the config-file, on line 14, I certainly defined the variable:
Code:
$config['base_url'] = "http://127.0.0.1/xyz/";  //notice change here...case sensitive now try it.

Still there is error show me your code

#4
[eluser]sl3dg3hamm3r[/eluser]
Thank you guys, you helped me both!

Have a nice day!


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.