I have a strange situation ...
After creating the ZF2 SkeletonApplication, I created an additional module called Authentication with AuthController and LoginAction, also in the browsing directory "authentication / auth" I placed login.phtml.
When I launch the application, I get an error
Zend\View\Renderer\PhpRenderer::render: Unable to render template "authentication/auth/login"; resolver could not resolve to a file
It is strange that when I put the full folder “authentication / auth / login.phtml” in the view folder of the standard application module, it finds it.
So, Zend is looking for the wrong directory.
This is my module.config.php (authentication module).
return array( 'router' => array( 'routes' => array( 'authentication' => array( 'type' => 'Zend\Mvc\Router\Http\Literal', 'options' => array( 'route' => '/authentication/login', 'defaults' => array( 'controller' => 'Authentication\Controller\Auth', 'action' => 'login', ), ), ), ), ), 'controllers' => array( 'invokables' => array( 'Authentication\Controller\Auth' => 'Authentication\Controller\AuthController', ), ), 'viewmanager' => array( 'template_path_stack' => array( 'authentication' => __DIR__ . '/../view', ), ) );
This is AuthController
namespace Authentication\Controller; use Zend\Mvc\Controller\AbstractActionController; use Zend\View\Model\ViewModel; class AuthController extends AbstractActionController { public function loginAction() { return new ViewModel(); } }
Hope someone can point me in the right direction.