Documentation ¶
Index ¶
- type LayoutTemplateManager
- type TemplateManager
- func (templateManager *TemplateManager) Close() error
- func (templateManager *TemplateManager) Execute(templateName string, writer io.Writer, data interface{}) (err error)
- func (templateManager *TemplateManager) Funcs(funcs template.FuncMap)
- func (templateManager *TemplateManager) GetTemplate(templateName string) (tpl *template.Template, err error)
- func (templateManager *TemplateManager) UseLayoutTemplate(layoutTemplateName string) *LayoutTemplateManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LayoutTemplateManager ¶
type LayoutTemplateManager struct { *TemplateManager // contains filtered or unexported fields }
LayoutTemplateManager loads and executes templates with a layout page
func (*LayoutTemplateManager) Execute ¶
func (layoutTemplateManager *LayoutTemplateManager) Execute(templateName string, writer io.Writer, data interface{}) (err error)
Execute a template named templateName
func (*LayoutTemplateManager) GetTemplate ¶
func (layoutTemplateManager *LayoutTemplateManager) GetTemplate(templateName string) (tpl *template.Template, err error)
GetTemplate gets a template from the templateFolder based on the templateName
type TemplateManager ¶
type TemplateManager struct {
// contains filtered or unexported fields
}
TemplateManager automatically loads, retrieves and executes templates
func NewTemplateManager ¶
func NewTemplateManager(templateFolder string) (templateManager *TemplateManager, err error)
NewTemplateManager creates a new TemplateManager based on templateFolder
func (*TemplateManager) Close ¶
func (templateManager *TemplateManager) Close() error
Close cleans up resources
func (*TemplateManager) Execute ¶
func (templateManager *TemplateManager) Execute(templateName string, writer io.Writer, data interface{}) (err error)
Execute a template named templateName
func (*TemplateManager) Funcs ¶
func (templateManager *TemplateManager) Funcs(funcs template.FuncMap)
Funcs adds template functions
func (*TemplateManager) GetTemplate ¶
func (templateManager *TemplateManager) GetTemplate(templateName string) (tpl *template.Template, err error)
GetTemplate gets a template from the templateFolder based on the templateName
func (*TemplateManager) UseLayoutTemplate ¶
func (templateManager *TemplateManager) UseLayoutTemplate(layoutTemplateName string) *LayoutTemplateManager
UseLayoutTemplate allows templates to be wrapped with a layout template
Click to show internal directories.
Click to hide internal directories.