I\'m writing a custom MVC framework for a PHP project and everything is great until it comes to getting arguments from the URL route. I\'m stuck on passing parts of the URL
For anyone who wants to know what I ended up doing, the final code is below... (this is from my router.class.php)
route = explode('/', $route);
/*** a new controller class instance ***/
$class = $this->controller . 'Controller';
$controller = new $class($this->registry);
/*** load arguments for action ***/
$arguments = array();
foreach ($this->route as $key => $val)
{
if ($key == 0 || $key == 1)
{
}
else
{
$arguments[$key] = $val;
}
}
/*** execute controller action w/ parameters ***/
call_user_func_array(array($controller, $action), $arguments);
?>
if my URL was
http://mysite.com/documentation/article/3
my controller looks like this...
Thanks for the help.