Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var TemplateFuncs = template.FuncMap{ "msg": func() string { return "hello this is a msg" }, "strDefault": func(str string, def string) string { if str != "" { return str } return def }, "timeFormat": func(t time.Time) string { return t.Format("2006-01-02 15:04:05") }, "time": func(t time.Time, layout string) string { return t.Format(layout) }, "now": func() time.Time { return time.Now() }, "tTime": func(t utils.JSONTime, layout string) string { return t.Format(layout) }, "admin": func() map[string]interface{} { return map[string]interface{}{ "name": "MD webSite", } }, "site": func(title string, args ...interface{}) *SiteInfo { return &SiteInfo{ Title: title, User: &models.UserModel{}, } }, "tFormatDate": func(t utils.JSONTime) string { return t.Format("2006-01-02") }, "thisWeek": func() string { now := time.Now() delta := (time.Monday - now.Weekday()) if delta > 0 { delta = -6 } monday := now.AddDate(0, 0, int(delta)) return monday.Format("2006-01-02") }, "lastWeek": func() string { now := time.Now() delta := (time.Monday - now.Weekday()) if delta > 0 { delta = -6 } monday := now.AddDate(0, 0, int(delta-7)) return monday.Format("2006-01-02") }, "today": func() string { return time.Now().Format("2006-01-02") }, "yesterday": func() string { return time.Now().AddDate(0, 0, -1).Format("2006-01-02") }, "thisMonth": func() string { now := time.Now() return time.Date(now.Year(), now.Month(), 1, 0, 0, 0, 0, now.Location()).Format("2006-01-02") }, "lastMonth": func() string { now := time.Now() return time.Date(now.Year(), now.Month()-1, 1, 0, 0, 0, 0, now.Location()).Format("2006-01-02") }, "url": MakeURL, "strJoin": func(str string, args ...interface{}) string { return fmt.Sprintf(str, args...) }, }
TemplateFuncs 模板方法
Functions ¶
Types ¶
type TemplateRenderer ¶
TemplateRenderer is a custom html/template renderer for Echo framework
Click to show internal directories.
Click to hide internal directories.