简体   繁体   English

Zend\\View\\Renderer\\PhpRenderer::render:无法渲染模板“应用程序/用户仪表板/索引”; 解析器无法解析到文件

[英]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.

相关问题 Zend \\ View \\ Renderer \\ PhpRenderer :: render:无法渲染模板,解析器无法解析为文件 - Zend\View\Renderer\PhpRenderer::render: Unable to render template, resolver could not resolve to a file Zend Framework 2无法呈现模板; 解析器无法解析为第461行上的PhpRenderer.php中的文件 - Zend Framework 2 Unable to render template ; resolver could not resolve to a file' in PhpRenderer.php on line 461 Zend \\ View \\ Renderer \\ PhpRenderer :: render:无法渲染模板 - Zend\View\Renderer\PhpRenderer::render: Unable to render template Zend \\ View \\ Renderer \\ PhpRenderer :: render:无法渲染模板 - Zend\View\Renderer\PhpRenderer::render: Unable to render template Laminas\View\Renderer\PhpRenderer::render: 无法渲染模板 - Laminas\View\Renderer\PhpRenderer::render: Unable to render template 无法渲染模板...解析器无法解析为文件 - Unable to render template … resolver could not resolve to a file Laminas - 无法渲染模板“xxxxxxx”解析器无法解析为文件 - Laminas - Unable to render template “xxxxxxx” resolver could not resolve to a file 无法呈现-解析器无法解析为文件 - Unable to render - resolver could not resolve to a file Zend Framework,PhpRenderer无法渲染模板将控制器添加到模板名称中 - Zend Framework, PhpRenderer unable to render template adds controllers into the template name Zend Framework 2无法呈现视图,解析器无法解析为文件。 为什么? - Zend Framework 2 fails to render view, resolver could not resolve to a file. Why?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM