func RenderTemplate(TplNames string, Data map[interface{}]interface{}) string { if beego.BConfig.RunMode == "dev" { beego.BuildTemplate(beego.BConfig.WebConfig.ViewsPath) } ibytes := bytes.NewBufferString("") err := beego.ExecuteTemplate(ibytes, TplNames, Data) if err != nil { beego.Trace("template Execute err:", err) } icontent, _ := ioutil.ReadAll(ibytes) return string(icontent) }
func RenderTemplate(TplNames string, Data map[interface{}]interface{}) string { if beego.RunMode == "dev" { beego.BuildTemplate(beego.ViewsPath) } ibytes := bytes.NewBufferString("") if _, ok := beego.BeeTemplates[TplNames]; !ok { panic("can't find templatefile in the path:" + TplNames) } err := beego.BeeTemplates[TplNames].ExecuteTemplate(ibytes, TplNames, Data) if err != nil { beego.Trace("template Execute err:", err) } icontent, _ := ioutil.ReadAll(ibytes) return string(icontent) }