Welcome Guest, Not a member yet? Register   Sign In
Access functions across controllers?
#1

[eluser]Unknown[/eluser]
How do I access functions from one controller in another one?
#2

[eluser]Michael;[/eluser]
You do not. If you need a function across multiple controllers it will need to be placed in a library. I recommend you create a "common" library that allows you to store these functions in. Works best for these types of cases.

If you end up with a few related functions then you should probably create yourself a new library for those functions ... like for example if you have 3-4 functions specifically for date/time manipulation.

Michael
#3

[eluser]nmweb[/eluser]
Search for HMVC and Wick for this kind of functionality. There are some perfectly valid causes for this behaviour.
#4

[eluser]Derek Allard[/eluser]
Just for clarity, (I'm not sure what you mean by "access" functions) but you can use
Code:
class Foo extends Controller {

    function one()
    {
        $this->two();
    }


    function two()
    {
        // do something
    }
}




Theme © iAndrew 2016 - Forum software by © MyBB