php 如何评论模板文件?(.tpl)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3985215/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 11:38:56  来源:igfitidea点击:

How to comment on template files? (.tpl)

phphtmlcsstemplatescomments

提问by Woppi

I am trying to do some commenting on a .html.tpl file I'm maintaining using

我正在尝试对我正在使用的 .html.tpl 文件进行评论

<!-- -->

but it would return syntax error.

但它会返回语法错误。

How do you put comment on such files?

你如何评论这些文件?

回答by Woppi

Solved! To comment on such files...I should use

解决了!要评论此类文件...我应该使用

{* INSERT COMMENT HERE *}

回答by Y. Joy Ch. Singha

My file name is product_form.tplIt works to me.

我的文件名是product_form.tpl它对我有用。

<!-- INSERT COMMENT HERE -->

回答by Alaa Awad

The only thing that worked for me was:

唯一对我有用的是:

{%* INSERT COMMENT HERE *%}

回答by igronus

It totally depends on template engine you are using. Some of them have no comment feature at all. You should carefully read documentation or browse source code if possible.

这完全取决于您使用的模板引擎。其中一些根本没有评论功能。如果可能,您应该仔细阅读文档或浏览源代码。

On my previous job I had to deal with really obsolete code from 90s with few internal-written template engines and at least in one of them I didn't find any comment feature after reading internal documentation. After browsing the code I realised that the template logic flow was based on top of few preg_replacecalls with no comment feature implementation at all.

在我之前的工作中,我不得不处理 90 年代的非常过时的代码,内部编写的模板引擎很少,至少在阅读内部文档后,我没有找到任何评论功能。浏览代码后,我意识到模板逻辑流基于少数preg_replace调用,根本没有注释功能实现。