I am newbie to Zend Framework 2.3 let's examine that i have multiple modules in my application in Zend framework 2.3 but i don't want create separate files for module configuration for routes i want to create dynamic routes so how can i perform it please help.
Asked
Active
Viewed 314 times
1
-
Duplicate of http://stackoverflow.com/questions/20771663/php-zend-framework-2-routing-with-dynamic-controller-name-but-same-controller – Purple Hexagon Oct 09 '14 at 08:03
-
wildcard routes are considered bad practice. It is advised to use explicit routes instead – Xerkus Oct 09 '14 at 09:56
-
Take a look at this route in zend skeleton application, but remember it is not recommended approach: https://github.com/zendframework/ZendSkeletonApplication/blob/master/module/Application/config/module.config.php#L23 – Xerkus Oct 09 '14 at 10:07
1 Answers
0
A global route is what you want :
'router' => array(
'routes' => array(
'home' => array(
'type' => 'Zend\Mvc\Router\Http\Segment',
'options' => array(
'route' => '/',
'defaults' => array(
'controller' => 'Application\Controller\Index',
),
),
),
'pages' => array(
'type' => 'Zend\Mvc\Router\Http\Segment',
'options' => array(
'route' => '/:module/[:controller[/:action[/:id]]]',
'constraints' => array(
'module' => '[a-zA-Z][a-zA-Z0-9_-]*',
'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'id' => '[a-zA-Z0-9_-]*'
),
),
),
),
),

Exlord
- 5,009
- 4
- 31
- 51