Documentation
¶
Index ¶
- func HtmlRender(tplPath string, viewData interface{}, includeFiles ...string) (res string)
- func ParseViewName(viewName string) string
- func SetTemplatePath(path string)
- func TextRender(tplPath string, viewData interface{}, includeFiles ...string) (res string)
- type DefaultEngine
- type IViewEngine
- type Option
- type Template
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HtmlRender ¶
func ParseViewName ¶
func SetTemplatePath ¶
func SetTemplatePath(path string)
func TextRender ¶
Types ¶
type DefaultEngine ¶
type DefaultEngine struct {
TemplatePath string
// contains filtered or unexported fields
}
func NewDefaultViewEngine ¶
func NewDefaultViewEngine() *DefaultEngine
func (*DefaultEngine) AddIncludeTmpl ¶
func (c *DefaultEngine) AddIncludeTmpl(viewName string)
添加引入模版
func (*DefaultEngine) SetTemplatePath ¶
func (c *DefaultEngine) SetTemplatePath(option *Option)
func (*DefaultEngine) ShareViewData ¶
func (c *DefaultEngine) ShareViewData(key string, viewData interface{})
全局通用模板变量
type IViewEngine ¶
type IViewEngine interface {
ViewHtml(viewName string, viewDataset ...interface{}) (string, error)
AddIncludeTmpl(viewName string)
SetTemplatePath(option *Option)
}
func CreateViewEngine ¶
func CreateViewEngine() IViewEngine
type Template ¶
type Template struct {
ViewName string
ViewPath string
IncludeTmpl []string
ShowData map[string]interface{}
// contains filtered or unexported fields
}
func (*Template) RenderText ¶
func (*Template) ViewDataKV ¶
view data is name and value , that value is interface{}
Click to show internal directories.
Click to hide internal directories.