![]() |
help with routes (i think?) - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: help with routes (i think?) (/showthread.php?tid=44575) |
help with routes (i think?) - El Forum - 08-19-2011 [eluser]jblack199[/eluser] Alright, so here is a question and I am sure it will have to do with routes... I am developing a project we'll call the url http://domain.com/debts so under debts i have my codeigniter installed and functioning properly.. but there are multiple lists that I'll need to create (different pages) which will come off a master-list.. so first page: list item 1 list item 2 list item 3 those would be 3 links to: http://domain.com/debts/1 http://domain.com/debts/2 http://domain.com/debts/3 and so on... now when I click on one of the links -- it takes me to the 2nd page which is a list of debts for that 'client' as input in the database.. but i can also add debts... so my url for that would be: http://www.domain.com/debts/1/add so the 1 is the variable number... but to throw something else in the mix, here is yet another conundrum for you... in the same list (/debts/1/) I can delete/edit on of the debts... so my URL's for them would be (/debts/1/delete/54) or (/debts/1/edit/125) the #'s are the only variable information that would be driven from the database.. so -- how exactly to do it... help with routes (i think?) - El Forum - 08-19-2011 [eluser]kilishan[/eluser] You could either use routes or the _remap method in your controller. Either one would be pretty simple. Here's the routes version: Code: $route['debts/(:num)/[a-z_]') = 'debts/$2/$1'; Basically what this does is to reverse the order of the uri segments as they come into your controller. So, it would still be calling the debts->edit method, with the third uri available as the only parameter to that method. Code: class debts extends CI_Controller { help with routes (i think?) - El Forum - 08-19-2011 [eluser]byde[/eluser] im not very sure but ill try something like this Code: class Debts extends CI_Controller { help with routes (i think?) - El Forum - 08-20-2011 [eluser]danmontgomery[/eluser] eval: bad, routing: good |