![]() |
Function to call functions...? (newbie question) - 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: Function to call functions...? (newbie question) (/showthread.php?tid=28733) |
Function to call functions...? (newbie question) - El Forum - 03-19-2010 [eluser]Juan Velandia[/eluser] It´s Ok to call a function from another function in the same controller? Code: function reload(){ It doesn´t seem to work for me, do you have Ideas? Thanks in advance! Function to call functions...? (newbie question) - El Forum - 03-19-2010 [eluser]bretticus[/eluser] It's not exactly apparent what you are trying to accomplish here. Are you trying to call a another method from the controller class? Or are you trying to use a function that will be used by the method that currently encapsulates it (anonymous function?) If it's the former, it's a simple $this->other_method() call (prepend an underscore to prevent this method from being routable.) If it's the latter, unless you are using PHP version 5.3.x use the intrisic PHP function: create_function. Function to call functions...? (newbie question) - El Forum - 03-19-2010 [eluser]Juan Velandia[/eluser] Hi Bretticus, thanks for the tip, Im going to check PHP function: create_function. perhaps I´ve been trying to solve this thing in the wrong way. Best Regards! Function to call functions...? (newbie question) - El Forum - 03-19-2010 [eluser]billmce[/eluser] [quote author="bretticus" date="1269046349"]It's not exactly apparent what you are trying to accomplish here. Are you trying to call a another method from the controller class? Or are you trying to use a function that will be used by the method that currently encapsulates it (anonymous function?) If it's the former, it's a simple $this->other_method() call (prepend an underscore to prevent this method from being routable.) If it's the latter, unless you are using PHP version 5.3.x use the intrisic PHP function: create_function.[/quote] When you say 'routable' ... what (in English) do you mean? (I did google this but 'routable' and 'php' turns up a lot of mapping routines). Function to call functions...? (newbie question) - El Forum - 03-19-2010 [eluser]bretticus[/eluser] [quote author="billmce" date="1269052209"] When you say 'routable' ... what (in English) do you mean? (I did google this but 'routable' and 'php' turns up a lot of mapping routines).[/quote] I was referring to "private" functions in controllers Which states... Quote:In some cases you may want certain functions hidden from public access. To make a function private, simply add an underscore as the name prefix and it will not be served via a URL request. Yes, my concept of "routable" gets lost in translation for sure. |