Can be method used as id? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Can be method used as id? (/showthread.php?tid=2355) |
Can be method used as id? - El Forum - 07-31-2007 [eluser]AndyBrandy[/eluser] Hi, Can i use method as id or parameter? I need From this url : example.com/text/programing/1/ go to the class "text" and here goes to index. It's real? Can be method used as id? - El Forum - 07-31-2007 [eluser]Michael Wales[/eluser] Code: <?php Can be method used as id? - El Forum - 07-31-2007 [eluser]AndyBrandy[/eluser] Aha! Thanks. :roll: Can be method used as id? - El Forum - 07-31-2007 [eluser]sophistry[/eluser] You could also do this with the Routing rules. Code: // not tested Be careful if you use _remap() you have to tell your controller what to do with all the other function names that might come in. I think if all you want to do is pass parameters to an index function you are better off with routing. Can be method used as id? - El Forum - 07-31-2007 [eluser]AndyBrandy[/eluser] I want use this for remap all functions in class. But both sides are good ideas. Can be method used as id? - El Forum - 07-31-2007 [eluser]Phil Sturgeon[/eluser] Remap has a few flaws, you have to manually input any URL segments to the controller. For example: Code: <?php Wont work, $param will show as blank. Use routes for this sort of thing if you need variables from the URL. Can be method used as id? - El Forum - 07-31-2007 [eluser]Michael Wales[/eluser] Or just use the URI helper. I agree though, rerouting is a good way to go. Remapping is nice for little things. |