错字3:没有找到模板。行动“列表”无法解析视图

问题描述 投票:1回答:1

当我点击左侧的模块时,我收到以下错误消息:

抱歉,找不到请求的视图。

技术原因是:

没有找到模板。无法解决“TYPO3 \ ShopExtension \ Controller \ ShopBackendController”类中的操作“列表”的视图。

我在这里看到了类似的问题,我尝试了所有的解决方案,没有成功。例如:

TYPO3: No template was found. View could not be resolved for action

我在配置目录的constants.ts文件中设置模板,部分和布局的根路径,如下所示:

module.tx_shopextension {
        view {
        templateRootPath = EXT:shop_extension/Resources/Private/Backend/Templates/

        partialRootPath = EXT:shop_extension/Resources/Private/Backend/Partials/

        layoutRootPath = EXT:shop_extension/Resources/Private/Backend/Layouts/
     }
        persistence {
            # cat=module.tx_shopextension//a; type=string; label=Default storage PID
            storagePid =
        }
    }

并在setup.ts中使用它们,如下所示:

# Module configuration
module.tx_shopextension {
    view {
        templateRootPath = {$module.tx_shopextension.view.templateRootPath}
        partialRootPath = {$module.tx_shopextension.view.partialRootPath}
        layoutRootPath = {$module.tx_shopextension.view.layoutRootPath}
    }
  persistence {
    storagePid = {$module.tx_shopextension.persistence.storagePid}
  }
} 

模板存储在:

Resources/Private/Backend/Templates/

(部分和布局的结构相同)

Resources/Private/Backend/Templates/目录中是一个ShopBackend目录,对应于ShopBackendController,包含List.html文件。

我无法弄清楚为什么错误会不断出现。

typo3 typo3-8.7.x
1个回答
1
投票

问题是,您使用旧方法来定义根路径。请使用根路径作为数组,如

 module.tx_shopextension.view.templateRootPaths.10 = EXT/shop_extension/Resources/Private/Backend/Templates/ 
© www.soinside.com 2019 - 2024. All rights reserved.