how do i use params in zf2 slimilar zf1

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

how do i use params in zf2 slimilar zf1

zamanphp
hi
how do i use params in zf2 slimilar zf 1 :

/madule/controller/action/param1/value1/param2/value2/........

i want use default route to all my app similar "Zend_Controller_Router_Route_Module" in zf1
is possible?
Reply | Threaded
Open this post in threaded view
|

Re: how do i use params in zf2 slimilar zf1

samsonasik
This post has NOT been accepted by the mailing list yet.
use wildcard :

 'test' => array(
      'type' => 'Zend\Mvc\Router\Http\Segment',
      'options' => array(
          'route' => '/test/[:controller[/:action]]',
          'constraints' => array(
              'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
              'action' => '[a-zA-Z][a-zA-Z0-9_-]*'
          ),
          'defaults' => array(
              'module' => 'Test',
              'controller' => 'Test\Controller\TestController',
              'action' => 'index',
          ),
      ),
      'may_terminate' => true,
      'child_routes' => array(
          'wildcard' => array(
              'type' => 'Zend\Mvc\Router\Http\Wildcard',
              'options' => array(
                  'key_value_delimiter' => '/',
                  'param_delimiter' => '/',
              ),
              'may_terminate' => true,
          ),
      ),
  ),

but it not recomended. you can use query param instead.
Reply | Threaded
Open this post in threaded view
|

Re: how do i use params in zf2 slimilar zf1

Artur Bodera
In reply to this post by zamanphp
On Fri, Oct 25, 2013 at 8:13 PM, zamanphp <[hidden email]> wrote:

> /madule/controller/action/param1/value1/param2/value2/........
>

http://framework.zend.com/manual/2.2/en/user-guide/routing-and-controllers.html


--
[hidden email]
+48 695 600 936
http://thinkscape.pro
Reply | Threaded
Open this post in threaded view
|

Re: how do i use params in zf2 slimilar zf1

zamanphp
In reply to this post by samsonasik
thanks samsonasik
it's true