func IndexController(rw http.ResponseWriter, rq *http.Request) { pastes := models.GetAll() t, err := template.ParseFiles("src/views/index.tpl") if err != nil { http.Error(rw, err.Error(), http.StatusInternalServerError) return } t.Execute(rw, pastes) }
func (this *IndexController) Get() { this.Data["blogs"] = models.GetAll() this.Layout = "layout.tpl" this.TplNames = "index.tpl" }