'error' => 'Application\Controller\ErrorController',
'view' => 'Zend\View\PhpRenderer',
),
-
- 'Zend\View\HelperLoader' => array(
- 'parameters' => array(
- 'map' => array(
- 'url' => 'Application\View\Helper\Url',
- ),
- ),
- ),
-
- 'Zend\View\HelperBroker' => array(
- 'parameters' => array(
- 'loader' => 'Zend\View\HelperLoader',
- ),
- ),
-
'Zend\View\PhpRenderer' => array(
'parameters' => array(
'resolver' => 'Zend\View\TemplatePathStack',
'application' => __DIR__ . '/../views',
),
),
- 'broker' => 'Zend\View\HelperBroker',
),
),
),
),
-
'routes' => array(
'default' => array(
- 'type' => 'Zend\Mvc\Router\Http\Regex',
+ 'type' => 'Zend\Mvc\Router\Http\Segment',
'options' => array(
- 'regex' => '/(?P<controller>[^/]+)(/(?P<action>[^/]+)?)?',
- 'spec' => '/%controller%/%action%',
+ 'route' => '/[:controller[/:action]]',
+ 'constraints' => array(
+ 'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
+ 'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
+ ),
'defaults' => array(
- 'controller' => 'error',
+ 'controller' => 'index',
'action' => 'index',
),
),
+++ /dev/null
-<?php
-namespace Application\View\Helper;
-
-use Zend\View\Helper\AbstractHelper,
- Zend\Mvc\Router\RouteStack;
-
-class Url extends AbstractHelper
-{
- protected $router;
-
- public function setRouter(RouteStack $router)
- {
- $this->router = $router;
- }
-
- public function __invoke($params = array(), $options = array())
- {
- if (null === $this->router) {
- return '';
- }
-
- // Remove trailing '/index' from generated URLs.
- $url = $this->router->assemble($params, $options);
- if ((6 <= strlen($url)) && '/index' == substr($url, -6)) {
- $url = substr($url, 0, strlen($url) - 6);
- }
-
- return $url;
- }
-}