[英]Zend\View\Renderer\PhpRenderer::render: Unable to render template "application/user-dashboard/index"; resolver could not resolve to a file
I am new to ZF2 and just trying to add one more controller in the ZF2 native application so that I can run my UserDashboard.phtml file , I am not able to understand , what is the error.我是 ZF2 的新手,只是想在 ZF2 本机应用程序中再添加一个控制器,以便我可以运行我的 UserDashboard.phtml 文件,我无法理解,这是什么错误。 Please help?
请帮忙?
Here is my module.config.php这是我的 module.config.php
<?php
namespace Application;
return array(
'router' => array(
'routes' => array(
'home' => array(
'type' => 'Zend\Mvc\Router\Http\Literal',
'options' => array(
'route' => '/',
'defaults' => array(
'controller' => 'Application\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
'application' => array(
'type' => 'Literal',
'options' => array(
'route' => '/application',
'defaults' => array(
'__NAMESPACE__' => 'Application\Controller',
'controller' => 'Index',
'action' => 'index',
),
),
'may_terminate' => true,
'child_routes' => array(
'default' => array(
'type' => 'Segment',
'options' => array(
'route' => '/[:controller[/:action]]',
'constraints' => array(
'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
),
'defaults' => array(
),
),
),
),
),
'UserDashboard' => array(
'type' => 'literal',
'options' => array(
'route' => '/profile',
'defaults' => array(
'__NAMESPACE__' => 'Application\Controller',
'controller' => 'Application\Controller\UserDashboard',
// 'action' => 'index',
),
),
),
),
),
'controllers' => array(
'invokables' => array(
'Application\Controller\Index' => 'Application\Controller\IndexController',
'Application\Controller\UserDashboard' => 'Application\Controller\UserDashboardController'
),
),
'service_manager' => array(
'abstract_factories' => array(
'Zend\Cache\Service\StorageCacheAbstractServiceFactory',
'Zend\Log\LoggerAbstractServiceFactory',
),
'factories' => array(
'translator' => 'Zend\Mvc\Service\TranslatorServiceFactory',
),
),
'translator' => array(
'locale' => 'en_US',
'translation_file_patterns' => array(
array(
'type' => 'gettext',
'base_dir' => __DIR__ . '/../language',
'pattern' => '%s.mo',
),
),
),
'view_manager' => array(
'display_not_found_reason' => true,
'display_exceptions' => true,
'doctype' => 'HTML5',
'not_found_template' => 'error\404',
'exception_template' => 'error\index',
'template_map' => array(
'layout\layout' => __DIR__ . '\..\view\layout\layout.phtml',
'application\index\index' => __DIR__ . '\..\view\application\index\index.phtml',
'application\UserDashboard\UserDashboard' => __DIR__ . '\..\view\application\UserDashboard\UserDashboard.phtml',
'error\404' => __DIR__ . '\..\view\error\404.phtml',
'error\index' => __DIR__ . '\..\view\error\index.phtml',
),
'template_path_stack' => array(
__DIR__ . '\..\view',
),
),
// Placeholder for console routes
'console' => array(
'router' => array(
'routes' => array(
),
),
),
);
and here is my directory structure这是我的目录结构
Application - > src - > Application - > Controller - > indexcontroller.php
->UserDashbaordcontroller.php
in views在视图中
Application -> index - > index.phtml
Application -> UserDashboard - > UserDashboard.phtml
In your view rename在您看来重命名
Application -> UserDashboard - > UserDashboard.phtml应用程序 -> UserDashboard -> UserDashboard.phtml
to:到:
Application -> user-dashboard - > index.phtml应用程序-> 用户仪表板-> index.phtml
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.