@@ -62,7 +62,7 @@ type IndexController struct {
62
62
func (this *IndexController ) Get () {
63
63
this.Data [" blogs" ] = models.GetAll ()
64
64
this.Layout = " layout.tpl"
65
- this.TplNames = " index.tpl"
65
+ this.TplName = " index.tpl"
66
66
}
67
67
```
68
68
ViewController:
@@ -74,10 +74,10 @@ type ViewController struct {
74
74
}
75
75
76
76
func (this *ViewController ) Get () {
77
- id , _ := strconv.Atoi (this.Ctx .Input .Params [" :id" ])
77
+ id , _ := strconv.Atoi (this.Ctx .Input .Params () [" :id" ])
78
78
this.Data [" Post" ] = models.GetBlog (id)
79
79
this.Layout = " layout.tpl"
80
- this.TplNames = " view.tpl"
80
+ this.TplName = " view.tpl"
81
81
}
82
82
```
83
83
NewController
@@ -89,7 +89,7 @@ type NewController struct {
89
89
90
90
func (this *NewController ) Get () {
91
91
this.Layout = " layout.tpl"
92
- this.TplNames = " new.tpl"
92
+ this.TplName = " new.tpl"
93
93
}
94
94
95
95
func (this *NewController ) Post () {
@@ -110,10 +110,10 @@ type EditController struct {
110
110
}
111
111
112
112
func (this *EditController ) Get () {
113
- id , _ := strconv.Atoi (this.Ctx .Input .Params [" :id" ])
113
+ id , _ := strconv.Atoi (this.Ctx .Input .Params () [" :id" ])
114
114
this.Data [" Post" ] = models.GetBlog (id)
115
115
this.Layout = " layout.tpl"
116
- this.TplNames = " edit.tpl"
116
+ this.TplName = " edit.tpl"
117
117
}
118
118
119
119
func (this *EditController ) Post () {
@@ -135,7 +135,7 @@ type DeleteController struct {
135
135
}
136
136
137
137
func (this *DeleteController ) Get () {
138
- id , _ := strconv.Atoi (this.Ctx .Input .Params [" :id" ])
138
+ id , _ := strconv.Atoi (this.Ctx .Input .Params () [" :id" ])
139
139
blog := models.GetBlog (id)
140
140
this.Data [" Post" ] = blog
141
141
models.DelBlog (blog)
0 commit comments