remapping - 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: remapping (/showthread.php?tid=33530) |
remapping - El Forum - 08-30-2010 [eluser]tzi0[/eluser] Hi all i have a _remap() function in my Admin controller: Code: function _remap($method) ok. now, if user requested a method with parameter, parameter doesnt pass: Code: function editcontent($id="none") remapping - El Forum - 08-30-2010 [eluser]WanWizard[/eluser] That is quite obvious. Your editcontent() method is called from _remap() using '$this->$method()', so without parameters. So either pass it in your call, or have your method determine the id itself. Where did you expect this id would magically come from? remapping - El Forum - 08-30-2010 [eluser]Clooner[/eluser] You should call your function using call_user_func_array and pass func_get_args for arguments! Your code doesn't pass through any arguments and logically it always will be none! remapping - El Forum - 08-30-2010 [eluser]tzi0[/eluser] I thought $method is passed with parameters already ... How to determine a requested parameter in my _remap() func? Through uri? remapping - El Forum - 08-30-2010 [eluser]tzi0[/eluser] [quote author="Jeroen Schaftenaar" date="1283180952"]You should call your function using call_user_func_array and pass func_get_args for arguments! Your code doesn't pass through any arguments and logically it always will be none![/quote] Code: function _remap($method) remapping - El Forum - 08-30-2010 [eluser]Clooner[/eluser] [quote author="tzi0" date="1283182265"][quote author="Jeroen Schaftenaar" date="1283180952"]You should call your function using call_user_func_array and pass func_get_args for arguments! Your code doesn't pass through any arguments and logically it always will be none![/quote] Code: function _remap($method) Why not try and read the documentation of the func_get_args on php.net? It means there are no arguments passed to the _remap method! Either make sure that happens or simply pass the uri segment array as argument. remapping - El Forum - 08-30-2010 [eluser]tzi0[/eluser] Already. Thanks guys. Done by passing uri segment to my function. |