0

I would like to get only one parameter. For example site.ru/controller/action/param1/value/

But if I request follow url: site.ru/controller/action/param1/value/param2/value2/param3/value4/ by default I havn't any error.

Is it possible to set up the depth for url parameters? Or I shuld do it manually via url parsing?

Phil
  • 157,677
  • 23
  • 242
  • 245
Anthony
  • 3,218
  • 3
  • 43
  • 73

3 Answers3

1

The default route allows any number of parameters after the :module/:controller/:action (or just :controller/:action) parts.

If you want to limit this, create your own route.

See http://framework.zend.com/manual/en/zend.controller.router.html

Phil
  • 157,677
  • 23
  • 242
  • 245
0

By default, there is no limit on the amount of param => value pairs used in the URL.

However you can create your own custom routes if you want to restrict the URL parameters

Stoosh
  • 2,408
  • 2
  • 18
  • 24
0

Consider this code:

$route = new Zend_Controller_Router_Route(
            '/:controller/:action/:id',
            array('controller'=>'index','action'=>'index','id'=>''), //default values
            array('controller'=>'[a-zA-Z-]','action'=>'[a-zA-Z-]+','id'=>'([0-9]+)') //patterns to match values
);

This route will be triggered only if request consists of controller name, action name and number for id. If any other parameters will be passed, route won't be triggered.

BasTaller
  • 811
  • 10
  • 18