I create my new users folder in module but it has error when I use localhost/zend/public/users/
but Zend\\View\\Renderer\\PhpRenderer::render: Unable to render template "users/users/index"; resolver could not resolve to a file
Zend\\View\\Renderer\\PhpRenderer::render: Unable to render template "users/users/index"; resolver could not resolve to a file
.i see some tutorials but not solved this problem. and also visit the zend's website.
my module.config.php
<?php
return array(
'controllers' => array(
'invokables' => array(
'Users\Controller\Users' => 'Users\Controller\UsersController',
),
),
// The following section is new and should be added to your file
'router' => array(
'routes' => array(
'users' => array(
'type' => 'segment',
'options' => array(
'route' => '/users[/:action][/:id]',
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'id' => '[0-9]+',
),
'defaults' => array(
'controller' => 'Users\Controller\Users',
'action' => 'index',
),
),
),
),
),
'view_manager' => array(
'template_path_stack' => array(
'users' => __DIR__ . '/../view',
),
),
);
The template_path_stack
configuration parameter tells you where the framework is going to search for the templates.
According to your configuration, the users/users/index
template should be in the __DIR__ . '/../view/users/users/index.phtml'
__DIR__ . '/../view/users/users/index.phtml'
file, where __DIR__
is the directory that contains your module.config.php
file.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.