Documentation ¶
Index ¶
- func AddFuncMap(key string, fn interface{}) error
- func AddTemplateExt(ext string)
- func AddViewPath(viewPath string) error
- func AssetsCSS(text string) template.HTML
- func AssetsJs(text string) template.HTML
- func BuildTemplate(dir string, files ...string) error
- func Compare(a, b interface{}) (equal bool)
- func CompareNot(a, b interface{}) (equal bool)
- func Date(t time.Time, format string) string
- func DateFormat(t time.Time, layout string) (datestring string)
- func DateParse(dateString, format string) (time.Time, error)
- func ExecuteTemplate(wr io.Writer, name string, data interface{}) error
- func ExecuteViewPathTemplate(wr io.Writer, name string, viewPath string, data interface{}) error
- func HTML2str(html string) string
- func HasTemplateExt(paths string) bool
- func Htmlquote(text string) string
- func Htmlunquote(text string) string
- func MapGet(arg1 interface{}, arg2 ...interface{}) (interface{}, error)
- func NotNil(a interface{}) (isNil bool)
- func ParseForm(form url.Values, obj interface{}) error
- func Register() common.Caller
- func RenderForm(obj interface{}) template.HTML
- func SetTemplateFSFunc(fnt templateFSFunc)
- func Str2html(raw string) template.HTML
- func Substr(s string, start, length int) string
- func URLFor(endpoint string, values ...interface{}) string
- func Walk(fs http.FileSystem, root string, walkFn filepath.WalkFunc) error
- type CallerCfg
- type CallerMuses
- type CallerTpl
- type Cfg
- type FileSystem
- type Tmpl
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddFuncMap ¶
AddFuncMap let user to register a func in the template.
func AddTemplateExt ¶
func AddTemplateExt(ext string)
AddTemplateExt add new extension for template.
func AddViewPath ¶
AddViewPath adds a new path to the supported view paths. Can later be used by setting a controller ViewPath to this folder will panic if called after beego.Run()
func BuildTemplate ¶
BuildTemplate will build all template files in a directory. it makes beego can render any template file in view directory.
func Compare ¶
func Compare(a, b interface{}) (equal bool)
Compare is a quick and dirty comparison function. It will convert whatever you give it to strings and see if the two values are equal. Whitespace is trimmed. Used by the template parser as "eq".
func DateFormat ¶
DateFormat takes a time and a layout string and returns a string with the formatted date. Used by the template parser as "dateformat"
func ExecuteTemplate ¶
ExecuteTemplate applies the template with name to the specified data object, writing the output to wr. A template will be executed safely in parallel.
func ExecuteViewPathTemplate ¶
ExecuteViewPathTemplate applies the template with name and from specific viewPath to the specified data object, writing the output to wr. A template will be executed safely in parallel.
func HasTemplateExt ¶
HasTemplateExt return this path contains supported template extension of beego or not.
func MapGet ¶
func MapGet(arg1 interface{}, arg2 ...interface{}) (interface{}, error)
MapGet getting value from map by keys usage:
Data["m"] = M{ "a": 1, "1": map[string]float64{ "c": 4, }, }
{{ map_get m "a" }} // return 1 {{ map_get m 1 "c" }} // return 4
func RenderForm ¶
RenderForm will render object to form html. obj must be a struct pointer.
func SetTemplateFSFunc ¶
func SetTemplateFSFunc(fnt templateFSFunc)
SetTemplateFSFunc set default filesystem function
func URLFor ¶
URLFor returns url string with another registered controller handler with params.
usage: URLFor(".index") print URLFor("index") router /login print URLFor("login") print URLFor("login", "next","/"") router /profile/:username print UrlFor("profile", ":username","John Doe") result: / /login /login?next=/ /user/John%20Doe more detail http://beego.me/docs/mvc/controller/urlbuilding.md
Types ¶
type CallerCfg ¶
type CallerMuses ¶
type CallerMuses struct {
Tpl CallerTpl `toml:"tpl"`
}
type Cfg ¶
type Cfg struct {
Muses CallerMuses `toml:"muses"`
}
type FileSystem ¶
type FileSystem struct { }
type Tmpl ¶
type Tmpl struct { // context data Data map[interface{}]interface{} // template data TplName string ViewPath string Layout string LayoutSections map[string]string // the key is the section name and the value is the template name TplPrefix string TplExt string // contains filtered or unexported fields }
func (*Tmpl) RenderBytes ¶
RenderBytes returns the bytes of rendered template string. Do not send out response.