You could also try extending the dispatcher (
Zend_Controller_Dispatcher_Standard) so that it passes the params to the
controller's action method using call_user_func_array().
Take a look at this page if you want to go down that route (no pun intended
;))

http://framework.zend.com/manual/en/zend.controller.dispatcher.html#zend.controller.dispatcher.subclassing

--
Hector


On Sat, Oct 10, 2009 at 12:18 AM, Hector Virgen <[email protected]> wrote:

> You could create a route with X number of named parameters and make them
> all optional:
> :controller/:action/:arg1/:arg2/:arg3/:arg4/:arg5...
>
> You can then create an action helper that gets all of those arg#parameters 
> and assigns them to the controller:
>
> class Default_Controller_Helper_ParamFetcher
> extends Zend_Controller_Action_Helper_Abstract
> {
>     public function preDispatch()
>     {
>         $request = $this->getRequest();
>         $controller = $this->getActionController();
>         $controller->args = array();
>         foreach ($request->getParams() as $key => $val) {
>             if (substr($key, 0, 3) == 'arg')) {
>                 $controller->args[] = $val;
>             }
>         }
>     }
> }
>
> It may be a little awkward building urls that match the route, but this may
> help you get on the right track to building a general-use route that looks
> how you want it to.
>
> I hope this helps :)
>
> --
> Hector
>
>
>
> On Fri, Oct 9, 2009 at 11:42 PM, arrrms <[email protected]> wrote:
>
>>
>> So rather than calling example.com/posts/archive/month/09/year/2008, I
>> could
>> just call example.com/posts/archive/09/2008. I know this is possible by
>> defining custom routes, but I want my entire application to work this way,
>> so writing a custom route for each action would be a nightmare. Before ZF,
>> I
>> was using a custom framework that would simply grab any parameters in the
>> URI (after controller/action/) and use call_user_func_array() to call the
>> controller's action. The action would then have those variables defined
>> within its signature, and that's how I would access them.  I'd like to
>> replicate this behavior.
>> --
>> View this message in context:
>> http://www.nabble.com/Can-I-globally-change-the-route-scheme-from-controller-action-key1-val1-key2-val2-to-just-controller-action-val1-val2--tp25831504p25831504.html
>> Sent from the Zend Framework mailing list archive at Nabble.com.
>>
>>
>

Reply via email to