Welcome Guest, Not a member yet? Register   Sign In
Newbie: urls Relative to Controller

Just getting started with CodeIgniter, and I'm having a problem with urls that I cannot figure out.

I call a controller (e.g. 'index.php/orgs/'). It calls the index function in the orgs controller, which loads a view. In the view, I use the url helper function:

<?=anchor('orgs/edit/'.$org->id, 'Edit') ?>

The resulting link is index.php/orgs/edit/1.

If I don't use the helper function (just use a href=), I get:


Okay, so I'll use the helper function, but in the tutorials, relative links seem to work with or without the helper functions.

What am I missing?

[eluser]Shay Falador[/eluser]
Use the url helper, and then just do:
&lt;a href="&lt;?php echo site_url('orgs/edit/'.$org->id); ?&gt;">Edit</a>
In order to achieve this.
If you don't want to use url helper you can call site_url from the url library..

Theme © iAndrew 2016 - Forum software by © MyBB