我想编写像 Smarty 的
capture
这样的模板函数。
我怎样才能捕获里面的html
{{capture}}
...
{{/capture}}
如何做到这一点?
最佳答案
{{define "T1"}}ONE{{end}}
{{define "T2"}}TWO{{end}}
{{define "T3"}}{{template "T1"}} {{template "T2"}}{{end}}
{{template "T3"}}
一二
关于function - 戈朗 : custom template function "capture",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24950916/