Skip to content
This repository has been archived by the owner on Jan 11, 2019. It is now read-only.

composer update之后模板加载错误 #13

Open
Totn opened this issue Nov 24, 2017 · 2 comments
Open

composer update之后模板加载错误 #13

Totn opened this issue Nov 24, 2017 · 2 comments

Comments

@Totn
Copy link

Totn commented Nov 24, 2017

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
Copy link
Author

Totn commented Nov 24, 2017

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

@Totn
Copy link
Author

Totn commented Nov 24, 2017

/****************** 修改开始 ********************/ // 解决模板 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()少了以上代码

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant