![]() |
routes help - 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: routes help (/showthread.php?tid=13094) Pages:
1
2
|
routes help - El Forum - 11-04-2009 [eluser]dippy[/eluser] anyone have some input on this? or can it not be done? routes help - El Forum - 11-04-2009 [eluser]BrianDHall[/eluser] [quote author="dippy" date="1256614431"]I have the following in my routes: Code: $route['services/:any'] = "services/section"; and then i also want to have a url like the following: 'services/towing/company-name' - and have that route to another function in the services controller to pull that's company info. can this be done? when i tried to do this all i kept getting was the section. so i added this for a temp. solution. Code: $route['search/:any'] = "services/search"; but id like to have it under services/section in the url. any suggestions?[/quote] Code: $route['services/(*+)' = "services/section/$1"; So services/towing would remap to services/section/towing, and services/towing/company would reroute to services/section/towing/company routes help - El Forum - 11-04-2009 [eluser]dippy[/eluser] Thank you routes help - El Forum - 11-04-2009 [eluser]dippy[/eluser] Do i make the section function in the services controller to be able to handle company names as well as the section name? how would the function be setup? routes help - El Forum - 11-04-2009 [eluser]dippy[/eluser] [quote author="BrianDHall" date="1257387164"][quote author="dippy" date="1256614431"]I have the following in my routes: Code: $route['services/:any'] = "services/section"; and then i also want to have a url like the following: 'services/towing/company-name' - and have that route to another function in the services controller to pull that's company info. can this be done? when i tried to do this all i kept getting was the section. so i added this for a temp. solution. Code: $route['search/:any'] = "services/search"; but id like to have it under services/section in the url. any suggestions?[/quote] Code: $route['services/(*+)' = "services/section/$1"; So services/towing would remap to services/section/towing, and services/towing/company would reroute to services/section/towing/company[/quote] i get the following when i replace the route with the following. Code: $route['services/(*+)' = "services/section/$1"; Code: A PHP Error was encountered routes help - El Forum - 11-04-2009 [eluser]BrianDHall[/eluser] That's a new one on me, whoops - try changing that * to a . and you should be ok then ![]() routes help - El Forum - 11-04-2009 [eluser]dippy[/eluser] [quote author="BrianDHall" date="1257389395"]That's a new one on me, whoops - try changing that * to a . and you should be ok then ![]() ahh thanks. works now. now would i just inside that section function use uri->segment to run thru different models? routes help - El Forum - 11-04-2009 [eluser]BrianDHall[/eluser] You can, or use function parameters - personal preference, really. routes help - El Forum - 11-04-2009 [eluser]dippy[/eluser] [quote author="BrianDHall" date="1257396871"]You can, or use function parameters - personal preference, really.[/quote] can you give me a quick example on what you mean? like this? Code: function section($section, $company) { ?? is that what you mean? i was thinking this way: Code: function section() { |