• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Here we go again, Anchor function doubles up url on call

#1
[eluser]edziffel[/eluser]
Finally got my anchor tag to call a method/function in the controller.
?php echo anchor('/drawback/hoeboy', 'click here');?>

Unfortunately on click it generates the following URL:

http://localhost/drawback.com/localhost/drawback/index.php/drawback/hoeboy

which ain't working, don't care where yer from. Note the right url which works fine

localhost/drawback/index.php/drawback/hoeboy, is appended to the current root url http://localhost/drawback.com.

Checked Url and anchor in users guide. Didn't see a cure.

A config setting? Played with a few the Url, routes etc. Didn't work.

Code:
function hoeboy() {
                echo "oh not again";
                }

It's not the code for hoeboy but included it so that it was clear that isn't it.

Ideas?

Thanks

#2
[eluser]edziffel[/eluser]
Little more info; just changed the anchor call to an <a> call with the correct url

Code:
<a href="http://localhost/drawback.com/index.php/drawback/hoeboy">Upload Data here</a>

Works fine like that and allows me to continue, but really want to get it working with just CI. Don't like slop.

#3
[eluser]InsiteFX[/eluser]
I told you before and I will tell you again remove the first /

InsiteFX

#4
[eluser]edziffel[/eluser]
InsiteFX

Thanks for the reply. Was pretty sure I did a bunch of "guess-a-fix" stuff to include playing with the quotes, none, double, single, and adding and removing slashes. Removed the leading front slash again tested and put it back, tested, and removed it again and tested, just to make sure and same results. Does the idea that removing the front slash doesn't change the results mean anything?

Browser set up properly to test: reloads every time. Uncommented out the anchor function and it fired right up then disappeared when commented out again just like it's supposed too. On fresh Linux install, fresh CI install. All else working as expected. Just FYI.

#5
[eluser]InsiteFX[/eluser]
Check your config base_url and make sure it has / on the end of it.

#6
[eluser]edziffel[/eluser]
InsiteFX

You nailed it! My default base_url in the config.php file was wrong, by a bunch. In retrospect, its surprising that it worked at all. Probably would not have figured it out in a month if you hadn't pointed me to it. Will double check all config entries to ensure that they comply to the example model.

You rock dude and thanks again!

Ed


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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