Call function from another function |
[eluser]luukskywalker[/eluser]
I have a small question. I have 2 functions in 1 controller Say Function A and Function B Is it possible to call function B at the end of Function A? If so, how is this done? I know i can call a view but i don't want a view at the end of function A
[eluser]jamesf[/eluser]
If the second function is an action with its own view you could redirect to that action Code: redirect('controller/functionb'); Or if the function is just some controller logic you can call the method using: Code: $this->function_b();
[eluser]jamesf[/eluser]
No problem, Also if the method is just controller logic then put an underscore before the function name so that it can't be accessed from a URL e.g. http://website/controller/function_b Code: $this->_function_b(); This "http://website/controller/function_b" will no longer work.
[eluser]luukskywalker[/eluser]
is it also possible to send variables from function a to function b? Because i want something like this(this is just an example): Code: Function_a(){ |
Welcome Guest, Not a member yet? Register Sign In |