管理菜单和路由期间 magento2 中的无效模板文件
Invalid Templates files in magento2 during admin menu and route
1 个异常:
异常 #0 (Magento\Framework\Exception\ValidatorException):无效的模板文件:模块中的 'Bss_CreateMenuBackend::helloworld.phtml':'Magento_Backend' 块的名称:'content_schedule_block1'
异常 #0 (Magento\Framework\Exception\ValidatorException): 模板文件无效:模块中的 'Bss_CreateMenuBackend::helloworld.phtml':'Magento_Backend' 块名称:'content_schedule_block1'
#1 Magento\Framework\View\Element\Template->_toHtml() called at [vendor\magento\module-backend\Block\Template.php:129]
#2 Magento\Backend\Block\Template->_toHtml() called at [vendor\magento\framework\View\Element\AbstractBlock.php:1097]
#3 Magento\Framework\View\Element\AbstractBlock->Magento\Framework\View\Element\{closure}() called at [vendor\magento\framework\View\Element\AbstractBlock.php:1101]
#4 Magento\Framework\View\Element\AbstractBlock->_loadCache() called at [vendor\magento\framework\View\Element\AbstractBlock.php:671]
#5 Magento\Framework\View\Element\AbstractBlock->toHtml() called at [vendor\magento\framework\View\Layout.php:557]
#6 Magento\Framework\View\Layout->_renderBlock('content_schedule...') called at [vendor\magento\framework\View\Layout.php:533]
#7 Magento\Framework\View\Layout->renderNonCachedElement('content_schedule...') called at [generated\code\Magento\Framework\View\Layout\Interceptor.php:206]
#8 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('content_schedule...') called at [vendor\magento\framework\View\Layout.php:488]
#9 Magento\Framework\View\Layout->renderElement('content_schedule...', false) called at [generated\code\Magento\Framework\View\Layout\Interceptor.php:193]
#10 Magento\Framework\View\Layout\Interceptor->renderElement('content_schedule...', false) called at [vendor\magento\framework\View\Layout.php:585]
#11 Magento\Framework\View\Layout->_renderContainer('content', false) called at [vendor\magento\framework\View\Layout.php:535]
#12 Magento\Framework\View\Layout->renderNonCachedElement('content') called at [generated\code\Magento\Framework\View\Layout\Interceptor.php:206]
#13 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('content') called at [vendor\magento\framework\View\Layout.php:488]
#14 Magento\Framework\View\Layout->renderElement('content', false) called at [generated\code\Magento\Framework\View\Layout\Interceptor.php:193]
#15 Magento\Framework\View\Layout\Interceptor->renderElement('content', false) called at [vendor\magento\framework\View\Layout.php:585]
#16 Magento\Framework\View\Layout->_renderContainer('main.col', false) called at [vendor\magento\framework\View\Layout.php:535]
#17 Magento\Framework\View\Layout->renderNonCachedElement('main.col') called at [generated\code\Magento\Framework\View\Layout\Interceptor.php:206]
#18 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('main.col') called at [vendor\magento\framework\View\Layout.php:488]
#19 Magento\Framework\View\Layout->renderElement('main.col', false) called at [generated\code\Magento\Framework\View\Layout\Interceptor.php:193]
#20 Magento\Framework\View\Layout\Interceptor->renderElement('main.col', false) called at [vendor\magento\framework\View\Layout.php:585]
#21 Magento\Framework\View\Layout->_renderContainer('admin.scope.col....', false) called at [vendor\magento\framework\View\Layout.php:535]
#22 Magento\Framework\View\Layout->renderNonCachedElement('admin.scope.col....') called at [generated\code\Magento\Framework\View\Layout\Interceptor.php:206]
#23 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('admin.scope.col....') called at [vendor\magento\framework\View\Layout.php:488]
#24 Magento\Framework\View\Layout->renderElement('admin.scope.col....', false) called at [generated\code\Magento\Framework\View\Layout\Interceptor.php:193]
#25 Magento\Framework\View\Layout\Interceptor->renderElement('admin.scope.col....', false) called at [vendor\magento\framework\View\Layout.php:585]
#26 Magento\Framework\View\Layout->_renderContainer('page.main.contai...', false) called at [vendor\magento\framework\View\Layout.php:535]
#27 Magento\Framework\View\Layout->renderNonCachedElement('page.main.contai...') called at [generated\code\Magento\Framework\View\Layout\Interceptor.php:206]
#28 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('page.main.contai...') called at [vendor\magento\framework\View\Layout.php:488]
#29 Magento\Framework\View\Layout->renderElement('page.main.contai...', false) called at [generated\code\Magento\Framework\View\Layout\Interceptor.php:193]
#30 Magento\Framework\View\Layout\Interceptor->renderElement('page.main.contai...', false) called at [vendor\magento\framework\View\Layout.php:585]
#31 Magento\Framework\View\Layout->_renderContainer('page.content', false) called at [vendor\magento\framework\View\Layout.php:535]
#32 Magento\Framework\View\Layout->renderNonCachedElement('page.content') called at [generated\code\Magento\Framework\View\Layout\Interceptor.php:206]
#33 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('page.content') called at [vendor\magento\framework\View\Layout.php:488]
#34 Magento\Framework\View\Layout->renderElement('page.content', false) called at [generated\code\Magento\Framework\View\Layout\Interceptor.php:193]
#35 Magento\Framework\View\Layout\Interceptor->renderElement('page.content', false) called at [vendor\magento\framework\View\Layout.php:585]
#36 Magento\Framework\View\Layout->_renderContainer('page.wrapper', false) called at [vendor\magento\framework\View\Layout.php:535]
#37 Magento\Framework\View\Layout->renderNonCachedElement('page.wrapper') called at [generated\code\Magento\Framework\View\Layout\Interceptor.php:206]
#38 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('page.wrapper') called at [vendor\magento\framework\View\Layout.php:488]
#39 Magento\Framework\View\Layout->renderElement('page.wrapper', false) called at [generated\code\Magento\Framework\View\Layout\Interceptor.php:193]
#40 Magento\Framework\View\Layout\Interceptor->renderElement('page.wrapper', false) called at [vendor\magento\framework\View\Layout.php:585]
#41 Magento\Framework\View\Layout->_renderContainer('backend.page', false) called at [vendor\magento\framework\View\Layout.php:535]
#42 Magento\Framework\View\Layout->renderNonCachedElement('backend.page') called at [generated\code\Magento\Framework\View\Layout\Interceptor.php:206]
#43 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('backend.page') called at [vendor\magento\framework\View\Layout.php:488]
#44 Magento\Framework\View\Layout->renderElement('backend.page', false) called at [generated\code\Magento\Framework\View\Layout\Interceptor.php:193]
#45 Magento\Framework\View\Layout\Interceptor->renderElement('backend.page', false) called at [vendor\magento\framework\View\Layout.php:585]
#46 Magento\Framework\View\Layout->_renderContainer('root', false) called at [vendor\magento\framework\View\Layout.php:535]
#47 Magento\Framework\View\Layout->renderNonCachedElement('root') called at [generated\code\Magento\Framework\View\Layout\Interceptor.php:206]
#48 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('root') called at [vendor\magento\framework\View\Layout.php:488]
#49 Magento\Framework\View\Layout->renderElement('root', true) called at [generated\code\Magento\Framework\View\Layout\Interceptor.php:193]
#50 Magento\Framework\View\Layout\Interceptor->renderElement('root') called at [vendor\magento\framework\View\Layout.php:954]
#51 Magento\Framework\View\Layout->getOutput() called at [generated\code\Magento\Framework\View\Layout\Interceptor.php:492]
#52 Magento\Framework\View\Layout\Interceptor->getOutput() called at [vendor\magento\framework\View\Result\Page.php:258]
#53 Magento\Framework\View\Result\Page->render(&Magento\Framework\App\Response\Http\Interceptor#000000005a145ea0000000002a77c2a8#) called at [vendor\magento\framework\View\Result\Layout.php:171]
#54 Magento\Framework\View\Result\Layout->renderResult(&Magento\Framework\App\Response\Http\Interceptor#000000005a145ea0000000002a77c2a8#) called at [generated\code\Magento\Backend\Model\View\Result\Page\Interceptor.php:193]
#55 Magento\Backend\Model\View\Result\Page\Interceptor->renderResult(&Magento\Framework\App\Response\Http\Interceptor#000000005a145ea0000000002a77c2a8#) called at [vendor\magento\framework\App\Http.php:141]
#56 Magento\Framework\App\Http->launch() called at [generated\code\Magento\Framework\App\Http\Interceptor.php:24]
#57 Magento\Framework\App\Http\Interceptor->launch() called at [vendor\magento\framework\App\Bootstrap.php:261]
#58 Magento\Framework\App\Bootstrap->run(&Magento\Framework\App\Http\Interceptor#000000005a145eab000000002a77c2a8#) called at [index.php:39]
根据 php 和 html 结构检查文件在路径上是否可用以及检查代码是否有效:
app/code/Bss/CreateMenuBackend/view/adminhtml/templates/helloworld.phtml
在布局文件中指定块名称为“content_schedule_block1”
示例错误。您应该遵循此文档:https://devdocs.magento.com/guides/v2.4/ext-best-practices/extension-coding/example-module-adminpage.html.
如果你想修复它。您只需要在 menu.xml.
中更改 resource="Magento_Backend"
1 个异常: 异常 #0 (Magento\Framework\Exception\ValidatorException):无效的模板文件:模块中的 'Bss_CreateMenuBackend::helloworld.phtml':'Magento_Backend' 块的名称:'content_schedule_block1'
异常 #0 (Magento\Framework\Exception\ValidatorException): 模板文件无效:模块中的 'Bss_CreateMenuBackend::helloworld.phtml':'Magento_Backend' 块名称:'content_schedule_block1'
#1 Magento\Framework\View\Element\Template->_toHtml() called at [vendor\magento\module-backend\Block\Template.php:129] #2 Magento\Backend\Block\Template->_toHtml() called at [vendor\magento\framework\View\Element\AbstractBlock.php:1097] #3 Magento\Framework\View\Element\AbstractBlock->Magento\Framework\View\Element\{closure}() called at [vendor\magento\framework\View\Element\AbstractBlock.php:1101] #4 Magento\Framework\View\Element\AbstractBlock->_loadCache() called at [vendor\magento\framework\View\Element\AbstractBlock.php:671] #5 Magento\Framework\View\Element\AbstractBlock->toHtml() called at [vendor\magento\framework\View\Layout.php:557] #6 Magento\Framework\View\Layout->_renderBlock('content_schedule...') called at [vendor\magento\framework\View\Layout.php:533] #7 Magento\Framework\View\Layout->renderNonCachedElement('content_schedule...') called at [generated\code\Magento\Framework\View\Layout\Interceptor.php:206] #8 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('content_schedule...') called at [vendor\magento\framework\View\Layout.php:488] #9 Magento\Framework\View\Layout->renderElement('content_schedule...', false) called at [generated\code\Magento\Framework\View\Layout\Interceptor.php:193] #10 Magento\Framework\View\Layout\Interceptor->renderElement('content_schedule...', false) called at [vendor\magento\framework\View\Layout.php:585] #11 Magento\Framework\View\Layout->_renderContainer('content', false) called at [vendor\magento\framework\View\Layout.php:535] #12 Magento\Framework\View\Layout->renderNonCachedElement('content') called at [generated\code\Magento\Framework\View\Layout\Interceptor.php:206] #13 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('content') called at [vendor\magento\framework\View\Layout.php:488] #14 Magento\Framework\View\Layout->renderElement('content', false) called at [generated\code\Magento\Framework\View\Layout\Interceptor.php:193] #15 Magento\Framework\View\Layout\Interceptor->renderElement('content', false) called at [vendor\magento\framework\View\Layout.php:585] #16 Magento\Framework\View\Layout->_renderContainer('main.col', false) called at [vendor\magento\framework\View\Layout.php:535] #17 Magento\Framework\View\Layout->renderNonCachedElement('main.col') called at [generated\code\Magento\Framework\View\Layout\Interceptor.php:206] #18 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('main.col') called at [vendor\magento\framework\View\Layout.php:488] #19 Magento\Framework\View\Layout->renderElement('main.col', false) called at [generated\code\Magento\Framework\View\Layout\Interceptor.php:193] #20 Magento\Framework\View\Layout\Interceptor->renderElement('main.col', false) called at [vendor\magento\framework\View\Layout.php:585] #21 Magento\Framework\View\Layout->_renderContainer('admin.scope.col....', false) called at [vendor\magento\framework\View\Layout.php:535] #22 Magento\Framework\View\Layout->renderNonCachedElement('admin.scope.col....') called at [generated\code\Magento\Framework\View\Layout\Interceptor.php:206] #23 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('admin.scope.col....') called at [vendor\magento\framework\View\Layout.php:488] #24 Magento\Framework\View\Layout->renderElement('admin.scope.col....', false) called at [generated\code\Magento\Framework\View\Layout\Interceptor.php:193] #25 Magento\Framework\View\Layout\Interceptor->renderElement('admin.scope.col....', false) called at [vendor\magento\framework\View\Layout.php:585] #26 Magento\Framework\View\Layout->_renderContainer('page.main.contai...', false) called at [vendor\magento\framework\View\Layout.php:535] #27 Magento\Framework\View\Layout->renderNonCachedElement('page.main.contai...') called at [generated\code\Magento\Framework\View\Layout\Interceptor.php:206] #28 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('page.main.contai...') called at [vendor\magento\framework\View\Layout.php:488] #29 Magento\Framework\View\Layout->renderElement('page.main.contai...', false) called at [generated\code\Magento\Framework\View\Layout\Interceptor.php:193] #30 Magento\Framework\View\Layout\Interceptor->renderElement('page.main.contai...', false) called at [vendor\magento\framework\View\Layout.php:585] #31 Magento\Framework\View\Layout->_renderContainer('page.content', false) called at [vendor\magento\framework\View\Layout.php:535] #32 Magento\Framework\View\Layout->renderNonCachedElement('page.content') called at [generated\code\Magento\Framework\View\Layout\Interceptor.php:206] #33 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('page.content') called at [vendor\magento\framework\View\Layout.php:488] #34 Magento\Framework\View\Layout->renderElement('page.content', false) called at [generated\code\Magento\Framework\View\Layout\Interceptor.php:193] #35 Magento\Framework\View\Layout\Interceptor->renderElement('page.content', false) called at [vendor\magento\framework\View\Layout.php:585] #36 Magento\Framework\View\Layout->_renderContainer('page.wrapper', false) called at [vendor\magento\framework\View\Layout.php:535] #37 Magento\Framework\View\Layout->renderNonCachedElement('page.wrapper') called at [generated\code\Magento\Framework\View\Layout\Interceptor.php:206] #38 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('page.wrapper') called at [vendor\magento\framework\View\Layout.php:488] #39 Magento\Framework\View\Layout->renderElement('page.wrapper', false) called at [generated\code\Magento\Framework\View\Layout\Interceptor.php:193] #40 Magento\Framework\View\Layout\Interceptor->renderElement('page.wrapper', false) called at [vendor\magento\framework\View\Layout.php:585] #41 Magento\Framework\View\Layout->_renderContainer('backend.page', false) called at [vendor\magento\framework\View\Layout.php:535] #42 Magento\Framework\View\Layout->renderNonCachedElement('backend.page') called at [generated\code\Magento\Framework\View\Layout\Interceptor.php:206] #43 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('backend.page') called at [vendor\magento\framework\View\Layout.php:488] #44 Magento\Framework\View\Layout->renderElement('backend.page', false) called at [generated\code\Magento\Framework\View\Layout\Interceptor.php:193] #45 Magento\Framework\View\Layout\Interceptor->renderElement('backend.page', false) called at [vendor\magento\framework\View\Layout.php:585] #46 Magento\Framework\View\Layout->_renderContainer('root', false) called at [vendor\magento\framework\View\Layout.php:535] #47 Magento\Framework\View\Layout->renderNonCachedElement('root') called at [generated\code\Magento\Framework\View\Layout\Interceptor.php:206] #48 Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('root') called at [vendor\magento\framework\View\Layout.php:488] #49 Magento\Framework\View\Layout->renderElement('root', true) called at [generated\code\Magento\Framework\View\Layout\Interceptor.php:193] #50 Magento\Framework\View\Layout\Interceptor->renderElement('root') called at [vendor\magento\framework\View\Layout.php:954] #51 Magento\Framework\View\Layout->getOutput() called at [generated\code\Magento\Framework\View\Layout\Interceptor.php:492] #52 Magento\Framework\View\Layout\Interceptor->getOutput() called at [vendor\magento\framework\View\Result\Page.php:258] #53 Magento\Framework\View\Result\Page->render(&Magento\Framework\App\Response\Http\Interceptor#000000005a145ea0000000002a77c2a8#) called at [vendor\magento\framework\View\Result\Layout.php:171] #54 Magento\Framework\View\Result\Layout->renderResult(&Magento\Framework\App\Response\Http\Interceptor#000000005a145ea0000000002a77c2a8#) called at [generated\code\Magento\Backend\Model\View\Result\Page\Interceptor.php:193] #55 Magento\Backend\Model\View\Result\Page\Interceptor->renderResult(&Magento\Framework\App\Response\Http\Interceptor#000000005a145ea0000000002a77c2a8#) called at [vendor\magento\framework\App\Http.php:141] #56 Magento\Framework\App\Http->launch() called at [generated\code\Magento\Framework\App\Http\Interceptor.php:24] #57 Magento\Framework\App\Http\Interceptor->launch() called at [vendor\magento\framework\App\Bootstrap.php:261] #58 Magento\Framework\App\Bootstrap->run(&Magento\Framework\App\Http\Interceptor#000000005a145eab000000002a77c2a8#) called at [index.php:39]
根据 php 和 html 结构检查文件在路径上是否可用以及检查代码是否有效:
app/code/Bss/CreateMenuBackend/view/adminhtml/templates/helloworld.phtml
在布局文件中指定块名称为“content_schedule_block1”
示例错误。您应该遵循此文档:https://devdocs.magento.com/guides/v2.4/ext-best-practices/extension-coding/example-module-adminpage.html.
如果你想修复它。您只需要在 menu.xml.
中更改 resource="Magento_Backend"