Welcome Guest, Not a member yet? Register   Sign In
Here we go again, Anchor function doubles up url on call

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:


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.

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.



Little more info; just changed the anchor call to an <a> call with the correct url

<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.

I told you before and I will tell you again remove the first /



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.

Check your config base_url and make sure it has / on the end of it.


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!


Theme © iAndrew 2016 - Forum software by © MyBB