FAQ
one template consist of other files in one directory(include define
template in file);
make an empty template(text or html);
parse each files to text template or use the cache;
use the parsed text template's *parse.Tree field(exported only for
html/template) and Templates method to get the provide and required
templates;
use the AddParseTree method to add each *parse.Tree(the same name templates
only include the first one, order is important for inherit) to the empty
template;
when all done, use the empty template's ExecuteTemplate with the template
name and data to render it;
support layout(a placeholder in the base template) and inherit.

source code at: https://github.com/dpkkkg/mytemplate

everything seems ok, need some advise or feedback, and more test, thanks
very much.

if correct, like FuncMap also can be added.

--

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedOct 23, '12 at 4:57a
activeOct 23, '12 at 4:57a
posts1
users1
websitegolang.org

1 user in discussion

Dpkkkg: 1 post

People

Translate

site design / logo © 2022 Grokbase