Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultConfig = Config{ Root: "views", Extension: ".html", Master: "templates/master", Partials: []string{}, Funcs: make(template.FuncMap), DisableCache: false, Delims: Delims{Left: "{{", Right: "}}"}, }
DefaultConfig default config
View Source
var HTMLContentType = []string{"text/html; charset=utf-8"}
HTMLContentType const templateEngineKey = "httpx_templateEngine"
Functions ¶
Types ¶
type Config ¶
type Config struct { Root string //view root Extension string //template extension Master string //template master Partials []string //template partial, such as head, foot Funcs template.FuncMap //template functions DisableCache bool //disable cache, debug mode Delims Delims //delimeters }
Config configuration options
type FileHandler ¶
FileHandler file handler interface
func DefaultFileHandler ¶
func DefaultFileHandler() FileHandler
DefaultFileHandler new default file handler
type ViewEngine ¶
type ViewEngine struct {
// contains filtered or unexported fields
}
ViewEngine view template engine
func (*ViewEngine) Render ¶
func (e *ViewEngine) Render(w http.ResponseWriter, statusCode int, name string, data interface{}) error
Render render template with http.ResponseWriter
func (*ViewEngine) RenderWriter ¶
func (e *ViewEngine) RenderWriter(w io.Writer, name string, data interface{}) error
RenderWriter render template with io.Writer
func (*ViewEngine) SetFileHandler ¶
func (e *ViewEngine) SetFileHandler(handle FileHandler)
SetFileHandler set file handler
Click to show internal directories.
Click to hide internal directories.