【发布时间】:2014-07-25 08:05:50
【问题描述】:
我想写像Smarty'scapture这样的模板函数。
如何在里面捕获 html
{{capture}}
...
{{/capture}}
如何做到这一点?
【问题讨论】:
我想写像Smarty'scapture这样的模板函数。
如何在里面捕获 html
{{capture}}
...
{{/capture}}
如何做到这一点?
【问题讨论】:
{{define "T1"}}ONE{{end}}
{{define "T2"}}TWO{{end}}
{{define "T3"}}{{template "T1"}} {{template "T2"}}{{end}}
{{template "T3"}}
两个
【讨论】:
您可以在应用程序中执行此操作:为您要捕获的 HTML sn-p 使用模板、渲染它、将其保存为字符串并在后续模板渲染中使用它。
【讨论】: