views:

22

answers:

1

Is this even possible? By using a custom route like:

$route['ajax/:any'] = "ajax/route";

And then declaring the method private in the controller:

class Ajax extends Controller {

        function _route()
        {
            some code here...
        }

}

I know this example does not work in practice, but you get the idea.

+1  A: 

Not really but you could have something like this:

    class Ajax extends Controller {

            function route($var)
            {
                $this->_handle($var)
            }

            function otherfunc($var)
            {
                $this->_handle($var)
            }

            function _handle($var)
            {
                  switch($var)
                  {

                      // Cases here
                  }
            }
    }

Unless _handle is a multiple use function eg, it is going to be called from more than one controller function i dont see the point.

Examples that i myself use are:

_check_login();
_redirect();

And other such functions.

DRL