diff --git a/zh/13.5.md b/zh/13.5.md index d42e5617..9cd2f12a 100644 --- a/zh/13.5.md +++ b/zh/13.5.md @@ -62,7 +62,7 @@ type IndexController struct { func (this *IndexController) Get() { this.Data["blogs"] = models.GetAll() this.Layout = "layout.tpl" - this.TplNames = "index.tpl" + this.TplName = "index.tpl" } ``` ViewController: @@ -74,10 +74,10 @@ type ViewController struct { } func (this *ViewController) Get() { - id, _ := strconv.Atoi(this.Ctx.Input.Params[":id"]) + id, _ := strconv.Atoi(this.Ctx.Input.Params()[":id"]) this.Data["Post"] = models.GetBlog(id) this.Layout = "layout.tpl" - this.TplNames = "view.tpl" + this.TplName = "view.tpl" } ``` NewController @@ -89,7 +89,7 @@ type NewController struct { func (this *NewController) Get() { this.Layout = "layout.tpl" - this.TplNames = "new.tpl" + this.TplName = "new.tpl" } func (this *NewController) Post() { @@ -110,10 +110,10 @@ type EditController struct { } func (this *EditController) Get() { - id, _ := strconv.Atoi(this.Ctx.Input.Params[":id"]) + id, _ := strconv.Atoi(this.Ctx.Input.Params()[":id"]) this.Data["Post"] = models.GetBlog(id) this.Layout = "layout.tpl" - this.TplNames = "edit.tpl" + this.TplName = "edit.tpl" } func (this *EditController) Post() { @@ -135,7 +135,7 @@ type DeleteController struct { } func (this *DeleteController) Get() { - id, _ := strconv.Atoi(this.Ctx.Input.Params[":id"]) + id, _ := strconv.Atoi(this.Ctx.Input.Params()[":id"]) blog := models.GetBlog(id) this.Data["Post"] = blog models.DelBlog(blog)