• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
URI class fails

I'm a bit of a Codeigniter noob so forgive the question if it's a bit dumb...

I'm trying to use the URI class but I get nothing from functions such as base_url() or $this->uri->uri_string().

However "echo $_SERVER[@REQUEST_URI];" does work. I'm using Wampserver on WinXP. Does anyone have any ideas?

If its an error then you haven't loaded the helper: http://ellislab.com/codeigniter/user-gui...elper.html

Quote:Loading this Helper

This helper is loaded using the following code:


If that isn't the problem you'll need to be a bit more specific as to how the functions don't work. If their output is wrong check your config.php settings.

Thanks Brian. I've definitely loaded the helper so that's not the problem. Since my previous post I've tried changing the URI_PROTOCOL settings in the config.php file and the best outcome has been with the PATH_INFO setting. Now base_url() and a couple of other functions have begun working but I have problems with uri_string() and others.

To illustrate my problem, I have created a view with the following commands:
<?php echo(current_url()); ?> // produces 'http://localhost/ci/index.php'
<?php echo($this->uri->segment(1)); ?> // produces no output at all
<?php echo $_SERVER['PATH_INFO']; ?> // produces '/agent/profile/1'

All this is given in the view with "http://localhost/ci/index.php/agent/profile/1" in the browser address bar. As you can see uri->segment(n) doesn't seem to be working and the current_url seems to be wrong.

I hope this is clear enough. I've spent several hours looking at this and my brain feels fried...

Managed to fix it with one or more of the following steps. First, I switched to xampp, then I went about trying different URI_PROTOCOLS and I also deleted a call to load the URI class that was lying around in one of my other controllers - it's loaded by default anyway and I believe that was causing the problem. Thanks for you help though!

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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