Skip to content

Commit 907cf15

Browse files
authored
Merge pull request astaxie#888 from ADYOUNGiOS/master
有几处代码可能由于历史API原因编译不通过需要更改
2 parents 53900c3 + fcd2389 commit 907cf15

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

zh/13.5.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ type IndexController struct {
6262
func (this *IndexController) Get() {
6363
this.Data["blogs"] = models.GetAll()
6464
this.Layout = "layout.tpl"
65-
this.TplNames = "index.tpl"
65+
this.TplName = "index.tpl"
6666
}
6767
```
6868
ViewController:
@@ -74,10 +74,10 @@ type ViewController struct {
7474
}
7575

7676
func (this *ViewController) Get() {
77-
id, _ := strconv.Atoi(this.Ctx.Input.Params[":id"])
77+
id, _ := strconv.Atoi(this.Ctx.Input.Params()[":id"])
7878
this.Data["Post"] = models.GetBlog(id)
7979
this.Layout = "layout.tpl"
80-
this.TplNames = "view.tpl"
80+
this.TplName = "view.tpl"
8181
}
8282
```
8383
NewController
@@ -89,7 +89,7 @@ type NewController struct {
8989

9090
func (this *NewController) Get() {
9191
this.Layout = "layout.tpl"
92-
this.TplNames = "new.tpl"
92+
this.TplName = "new.tpl"
9393
}
9494

9595
func (this *NewController) Post() {
@@ -110,10 +110,10 @@ type EditController struct {
110110
}
111111

112112
func (this *EditController) Get() {
113-
id, _ := strconv.Atoi(this.Ctx.Input.Params[":id"])
113+
id, _ := strconv.Atoi(this.Ctx.Input.Params()[":id"])
114114
this.Data["Post"] = models.GetBlog(id)
115115
this.Layout = "layout.tpl"
116-
this.TplNames = "edit.tpl"
116+
this.TplName = "edit.tpl"
117117
}
118118

119119
func (this *EditController) Post() {
@@ -135,7 +135,7 @@ type DeleteController struct {
135135
}
136136

137137
func (this *DeleteController) Get() {
138-
id, _ := strconv.Atoi(this.Ctx.Input.Params[":id"])
138+
id, _ := strconv.Atoi(this.Ctx.Input.Params()[":id"])
139139
blog := models.GetBlog(id)
140140
this.Data["Post"] = blog
141141
models.DelBlog(blog)

0 commit comments

Comments
 (0)