Can I create a function inside a controller dinamically from a model?

#2
[eluser]WanWizard[/eluser]
No, but you can use the magic function __call() in your controller to capture calls to undefined methods:
Code:
function __call($method, $params)
{
    if ($method == 'second')
    {
        // do something here
    }
    else
    {
        return NULL;
    }
}

Still not very dynamic, but it's the only option.

I fail to see why you would want this though, where are you going to call this controller method()? If it's name is dynamic, that's going to be a challenge. If not, why not code it in the first place? You have to code it somewhere...


Messages In This Thread
Can I create a function inside a controller dinamically from a model? - by El Forum - 09-02-2010, 01:56 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.