URI Segments and links - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: URI Segments and links (/showthread.php?tid=62318) |
URI Segments and links - ramon183 - 07-02-2015 Hi, I have a problem in redirecting my links after using links with 3 parameters. That is, controller , action and parameter . Ok using a link like this <a href="House/register/1">Edit the house</a> I walk normally on the page and the right value ( 1). But my mistake is when I click a button on this page to return to the management page "House/index". This button there is this link <a href="House">Come back to the management Houses</a> , which would trigger a House controller and the index action. Ex.: www.web.com/House/index . But my URL is www.web.com/House/register/House, ie the link is becoming a parameter and not a redirect to the controller. PHP Code: <?php RE: URI Segments and links - Avenirer - 07-03-2015 if you want to create links you can create them relative to your domain with echo anchor('whatevercontroller/whatevermodel/params','The link name'); RE: URI Segments and links - ramon183 - 07-03-2015 (07-03-2015, 01:07 AM)Avenirer Wrote: if you want to create links you can create them relative to your domain with echo anchor('whatevercontroller/whatevermodel/params','The link name'); This is not what i want. My problem is not with links. Is the third segment only. If i doesn't pass the third segment in whatever links the links works fine like <a href='whatevercontroller/whateveraction' ></a> But if i clicked in the edit with the href='whatevercontroller/whateveraction/whateverparam' the uri is www.bla.com/whatevercontroller/whateveraction/whateverparam but if in this screen i clicked in a button to return like this href='whatevercontroller/whateveraction ' the url change only the param putting the controller called like param, like this www.bla.com/whatevercontroller/whateveraction/whatevercontroller I don't know why when i pass the third param the url bug the link. Just the url doesnt refresh, only set a param with the value of controller of the link clicked RE: URI Segments and links - CroNiX - 07-03-2015 Start your links with a /. Otherwise they will just append to the current url since they are "relative" urls. href='/whatevercontroller/whateveraction/whateverparam' href='/whatevercontroller/whateveraction' etc |