Documentation ¶
Overview ¶
leafveingo web 模板操作模块
leafveingo web 模板使用函数模块
Index ¶
- type Template
- func (t *Template) AddCacheTemplate(tplName, src string) error
- func (l *Template) BaseDir() string
- func (l *Template) DelAllFunc()
- func (l *Template) DelFunc(key string)
- func (l *Template) Execute(wr io.Writer, value TemplateValue) error
- func (l *Template) Get(tplPath string) *template.Template
- func (l *Template) IsCache() bool
- func (l *Template) IsCompactHTML() bool
- func (l *Template) IsDevel() bool
- func (l *Template) Parse(tplPath string) (tmpl *template.Template, err error)
- func (l *Template) ParseString(name, src string) (tmpl *template.Template, err error)
- func (l *Template) SetBaseDir(path string)
- func (l *Template) SetCache(cache bool)
- func (l *Template) SetCompactHTML(compact bool)
- func (t *Template) SetDelims(left, right string)
- func (l *Template) SetDevel(isDevel bool)
- func (l *Template) SetFunc(key string, methodFunc interface{})
- func (l *Template) TemplatePathAtName(tplName string) string
- type TemplateValue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Template ¶
type Template struct {
// contains filtered or unexported fields
}
leafveingo 内置模板结构,用于私有的实现
func (*Template) AddCacheTemplate ¶
*
- add cache template *
- @param name unique name
- @param src template content, if empty by name lookup cache template
func (*Template) Execute ¶
func (l *Template) Execute(wr io.Writer, value TemplateValue) error
*
- execute template * *
- @param wr
- @param value
- @return error
func (*Template) Parse ¶
*
- pares template by relative path *
- @param tplPath
- @return *template.Template
- @return error
func (*Template) ParseString ¶
*
- parse template string, not template path *
- @param name unique name
- @param src template content, if empty by name lookup cache template
- @return *template.Template
- @return error
func (*Template) SetBaseDir ¶
*
- set template base directory path
- 设置模板查询主目录,默认"".
- 主目录空的话就会按照编译文件所在目录开始查询模板 *
- @param path full path
func (*Template) SetDelims ¶
*
- set the action delimiters left default {{ }} *
- @param left
- @param right
func (*Template) SetFunc ¶
*
- set template func *
- default func see lv_tempate_func.go
- "LVEmbedTempate" LVTemplate.EmbedTempate //嵌入模板函数 *
- @param key
- @param methodFunc
func (*Template) TemplatePathAtName ¶
*
- template name join full path *
- @param tplName
- @return not find is ""
type TemplateValue ¶
type TemplateValue struct { TplName string // template name precedence handle TplPath string // template relative path ContentType string // response header Content-Type Data interface{} // bind data }
模板数据,用于封装使用模板的数据传递
func NewTemplateValue ¶
func NewTemplateValue(tplPath string, data interface{}) TemplateValue
new template value @tplPth 相对路径 @data 模板数据
func NewTemplateValueByName ¶
func NewTemplateValueByName(tplName string, data interface{}) TemplateValue
*
*
Click to show internal directories.
Click to hide internal directories.