Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ROUTE
- 'test' => array(
- 'type' => 'segment',
- 'options' => array(
- 'route' => '/test[/:action][/:id]',
- 'constraints' => array(
- 'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
- 'par' => '[0-9]+',
- ),
- 'defaults' => array(
- 'controller' => 'test/test',
- 'action' => 'index',
- ),
- ),
- ),
- # CONTROLLER
- <?php
- namespace Something\Controller;
- class TestController extends AbstractActionController
- {
- public function indexAction()
- {
- echo 'index';
- echo (int) $this->params()->fromRoute('id');
- }
- public function hahaAction()
- {
- echo 'haha';
- echo (int) $this->params()->fromRoute('id');
- }
- }
- # URLS
- /test prints index0
- /test/haha prints haha0
- /test/haha/33 prints haha33
- /test/33 prints my layout + error page with "The requested controller was unable to dispatch the request."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement