I have created new module called 'currency' and configured routes in module.config. It is working fine. After that I have added new controller called CrateController for currency rates.And also created forms, models and view files. But It is not routing correctly.
Error:
Fatal error: Uncaught exception 'Zend\View\Exception\RuntimeException' with message 'Zend\View\Renderer\PhpRenderer::render: Unable to render template "currency/crate/index"; resolver could not resolve to a file....
Any clue to check this out will be helpful.
My module.config file as follows.
return array(
'controllers' => array(
'invokables' => array(
'Currency\Controller\Currency' => 'Currency\Controller\CurrencyController',
'Currency\Controller\Crate' => 'Currency\Controller\CrateController',
),
),
// The following section is new and should be added to your file
'router' => array(
'routes' => array(
'currency' => array(
'type' => 'segment',
'options' => array(
'route' => '/currency[/:action][/:currency_id]',
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'currency_id' => '[0-9]+',
),
'defaults' => array(
'controller' => 'Currency\Controller\Currency',
'action' => 'index',
),
),
),
'crate' => array(
'type' => 'segment',
'options' => array(
'route' => '/crate[/:action][/:c_rate_id]',
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'c_rate_id' => '[0-9]+',
),
'defaults' => array(
'controller' => 'Currency\Controller\Crate',
'action' => 'index',
),
),
),
),
),
Check for two things:
First: Is the template file present? ./module/Currency/view/currency/crate/index.phtml
Second: Check for the following entry inside ./Currency/config/module.config.php
'view_manager' => array(
'template_path_stack' => array(
'currency' => __DIR__ . '/../view',
)
),