>  function demo($arg1, $arg2) {
>   $args = func_get_args();
>   $arg3 = $args[2];
>
> }

how about a method which checks the expected number of methods and
redirects to that with a 301 if you have more than the expected?

// App controller method
public function seoCheck($funcArgs=null, $allowedArgs=null, $baseUrl='/')
{
        // check for some values
        if (isset($funcArgs) && isset($allowedArgs))
        {
                // check if more than the allowed args were pass
                if (count($funcArgs) > $allowedArgs)
                {
                        // extract just the args we want
                        $argsForRedirect = array_slice($funcArgs, 0, 
$allowedArgs);
                        // redirect
                        $this->redirect($baseUrl.join('/', $argsForRedirect), 
301);
                        // kill function
                        exit;
                }
        }
}

// controller method, called with custom route: /article/{id}/{slug}
public function view($id=null, $slug=null)
{       
        $this->seoCheck(func_get_args(), 2, '/article/');
}

// controller method, called with default route: /controller/method/{id}
public function view($slug=null)
{       
        $this->seoCheck(func_get_args(), 1, '/pages/view/');
}

Not sure how this fairs with named parameters etc though.

hth

jon

-- 

jon bennett
w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to