Browse Source

Render for backend

Vova Tkach 6 years ago
parent
commit
dccb52603a
1 changed files with 15 additions and 0 deletions
  1. 15 0
      engine/wrapper/wrapper.go

+ 15 - 0
engine/wrapper/wrapper.go

@@ -145,3 +145,18 @@ func (this *Wrapper) RenderFrontEnd(tname string, data interface{}) {
 		Data:   data,
 	})
 }
+
+func (this *Wrapper) RenderBackEnd(tcont []byte, data interface{}) {
+	tmpl, err := template.New("template").Parse(string(tcont))
+	if err != nil {
+		utils.SystemErrorPageEngine(this.W, err)
+		return
+	}
+	this.W.WriteHeader(http.StatusOK)
+	this.W.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
+	this.W.Header().Set("Content-Type", "text/html; charset=utf-8")
+	tmpl.Execute(this.W, consts.TmplData{
+		System: utils.GetTmplSystemData(),
+		Data:   data,
+	})
+}