I am new to Zend Framework 2.
I have several Modules, when a user starts the application I want to display the RecruitCore module, thats why my only route at the moment is 'route' => '/', so this is my module.config.php for RecruitCore:
return array(
'router' => array(
'routes' => array(
'home' => array(
'type' => 'Zend\Mvc\Router\Http\Literal',
'options' => array(
'route' => '/',
'defaults' => array(
'controller' => 'RecruitCore\Controller\Index',
'action' => 'index',
),
),
),
),
),
'controllers' => array(
'invokables' => array(
'RecruitCore\Controller\Index' => 'RecruitCore\Controller\IndexController',
),
),
'view_manager' => array(
'display_not_found_reason' => true,
'display_exceptions' => true,
'doctype' => 'HTML5',
//'not_found_template' => 'error/404',
//'exception_template' => 'error/index',
'template_path_stack' => array(
__DIR__ . '/../view',
),
),
);
I have an IndexController in src/RecruitCore/Controller/IndexController with a method indexAction which gets called, because my debug messages are getting fired. But instead of displaying the view/recruit-core/index/index.phtml layout, it always displays the layout/layout.phtml. The funny thing is, when I delete the view/recruit-core/index/index.phtml then i am getting an error message, but other then that, there is no other acknowledgment of view/recruit-core/index/index.phtml
so maybe I am missing something in module.config.php
$this->content
somewhere in it (this is where the view is shown) - do you have such a line in your layout? See the layout in the ZF2 skeleton for an example: github.com/zendframework/ZendSkeletonApplication/blob/master/… – Tim Fountain