Hola, agradezco sus respuestas, lo mejor es dejar la configuración del enrutamiento.
module.config.php
Código PHP:
Ver original<?php
'type' => 'Zend\Mvc\Router\Http\Literal',
'route' => '/',
'controller' => 'MyAccount\Controller\Index',
'action' => 'index',
),
),
),
// The following is a route to simplify getting started creating
// new controllers and actions without needing to create a new
// module. Simply drop new controllers in, and you can access them
// using the path /application/:controller/:action
'type' => 'Literal',
'route' => '/myaccount',
'__NAMESPACE__' => 'MyAccount\Controller',
'controller' => 'Index',
'action' => 'index',
),
),
'may_terminate' => true,
'type' => 'Segment',
'route' => '/[:controller[/:action]]',
'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
),
),
),
),
),
),
),
),
'service_manager' => array( 'translator' => 'Zend\I18n\Translator\TranslatorServiceFactory',
),
),
'locale' => 'en_US',
'translation_patterns' => array( 'type' => 'gettext',
'base_dir' => __DIR__ . '/../language',
'pattern' => '%s.mo',
),
),
),
'MyAccount\Controller\Index' => 'MyAccount\Controller\IndexController',
'MyAccount\Controller\Sell' => 'MyAccount\Controller\SellController',
),
),
'display_not_found_reason' => true,
'display_exceptions' => true,
'doctype' => 'HTML5',
'not_found_template' => 'error/404',
'exception_template' => 'error/index',
'layout/layout' => __DIR__ . '/../view/layout/layout.phtml',
'error/404' => __DIR__ . '/../view/error/404.phtml',
'error/index' => __DIR__ . '/../view/error/index.phtml',
),
'template_path_stack' => array( __DIR__ . '/../view',
),
),
);
En base a esto, cuando quiero ir a indexAction de SellController, accedo perfectamente de la siguiente forma:
http://example.com/myaccount/sell/index o
http://example.com/myaccount/sell
Y cuando ejecuto $this->url('myaccount', array('controller'=>'sell')); me devuelve "http://example.com/myaccount" y yo quiero que me devuelva "http://example.com/myaccount/sell".
¿Qué hago?, gracias :)