tpAdmin icon indicating copy to clipboard operation
tpAdmin copied to clipboard

composer update之后模板加载错误

Open Totn opened this issue 8 years ago • 2 comments

composer update 之后tp框架会升级5.0.12 然后页面会报错:

模板文件不存在 ....

经查, 模板中的代码 {include file='form' /} 解析之后的路径为 ./application/admin\view\form.html 实际的路径为 ./application/admin\view\admin_group\form.html 进而抛出异常:

'template not exists:' xxxxx

Totn avatar Nov 24 '17 09:11 Totn

解决方案: 将{include file='form' /} 改为 {include file='admin_group/form' /} admin_group为controller对应的view下面的文件夹名

Totn avatar Nov 24 '17 09:11 Totn

/****************** 修改开始 ********************/ // 解决模板 include 标签不支持自动定位当前控制器的问题 if (!preg_match("/(\/|\:)/", $templateName)) { $templateName = str_replace(".", DS, \think\Loader::parseName(\think\Request::instance()->controller())) . DS . $templateName; } /****************** 修改结束 ********************/ TP 5.0.12中的Template.php::parseTemplateName()少了以上代码

Totn avatar Nov 24 '17 10:11 Totn