Welcome Guest, Not a member yet? Register   Sign In
remapping controllers' function calls: what about arguments?
#5

[eluser]kewisch[/eluser]
I think this should be part of the next release, since it adds some consistency. I created a patch to take care of this in a code-igniter way.

Code:
--- system/codeigniter/CodeIgniter.php  2007-07-12 12:53:28.000000000 +0000
+++ system/codeigniter/CodeIgniter.php  2007-11-04 11:59:21.000000000 +0000
@@ -198,12 +198,14 @@ else
         * ------------------------------------------------------
         */
        $EXT->_call_hook('post_controller_constructor');

+       $params = array_slice($RTR->rsegments, (($RTR->fetch_directory() == '') ? 2 : 3));
+
        // Is there a "remap" function?
        if (method_exists($CI, '_remap'))
        {
-               $CI->_remap($method);
+               call_user_func_array(array(&$CI, "_remap"), array($method, $params));
        }
        else
        {
                if ( ! method_exists($CI, $method))
@@ -212,9 +214,9 @@ else
                }

                // Call the requested method.
                // Any URI segments present (besides the class/function) will be passed to the method for convenience
-               call_user_func_array(array(&$CI, $method), array_slice($RTR->rsegments, (($RTR->fetch_directory() == '') ? 2 : 3)));
+               call_user_func_array(array(&$CI, $method), $params);
        }
}

// Mark a benchmark end point


Messages In This Thread
remapping controllers' function calls: what about arguments? - by El Forum - 11-04-2007, 06:14 AM



Theme © iAndrew 2016 - Forum software by © MyBB