Welcome Guest, Not a member yet? Register   Sign In
url_helper useless to me?
#1

[eluser]georgeoneill[/eluser]
Hi

I'm brand new to CI and having fun figuring it out. There's one major thing bothering me, I must be doing something wrong.

When I try to use the url helper functions (anchor() and redirect() to be specific), I get funny results. It seems to me that this is because they use site_url() instead of base_url().

I've used .htaccess to remove index.php from my urls, and I have the corresponding $config variable set to an empty string, as instructed.

Here's my example: if i'm on the page localhost/example/default and I have the code
Code:
anchor('somepage', 'link')

I'm expecting to get sent to: localhost/example/somepage when I click the link.

but instead i'm taken to: localhost/example/default/localhost/example/somepage

I can easily work around this with native php, but I feel like I want to use the full capabilities of CodeIgniter whenever possible. Also I'm tempted to rewrite the functions using base_url instead of site_url but that seems too ham-handed.
#2

[eluser]Cristian Gilè[/eluser]
What is the site URL, as specified in your config file?
#3

[eluser]Abel A.[/eluser]
You probably didn't set your configs properly.
#4

[eluser]georgeoneill[/eluser]
$config['base_url']= "127.0.0.1/dmc_CI";

$config['uri_protocol'] = "AUTO"; I played with this one a bit, but with no luck.
#5

[eluser]CroNiX[/eluser]
Read the notes in the config file right where you changed that. Notice anything missing from your base_url that they mention needs to be there? Smile
#6

[eluser]georgeoneill[/eluser]
Oh, snap!
#7

[eluser]Learn CodeIgniter[/eluser]
Code:
anchor('controller/function', 'link')




Theme © iAndrew 2016 - Forum software by © MyBB