I want to write template function like Smarty's
capture
.
How can I capture html inside
{{capture}}
...
{{/capture}}
How to do this?
You would do it in the application: Use a template for the HTML snippet you want to capture, render it, save it to a string and use it in subsequent template rendering.
{{define "T1"}}ONE{{end}}
{{define "T2"}}TWO{{end}}
{{define "T3"}}{{template "T1"}} {{template "T2"}}{{end}}
{{template "T3"}}
ONE TWO