예제 #1
0
파일: edit.go 프로젝트: huishaolove520/blog
func (this *EditController) Get() {
	//inputs := this.Input()
	id, _ := strconv.Atoi(this.Ctx.Input.Params[":id"])
	this.Data["Post"] = models.GetBlog(id)
	this.Layout = "layout.tpl"
	this.TplNames = "edit.tpl"
}
예제 #2
0
func (this *ViewController) Get() {
	var id int
	this.Ctx.Input.Bind(&id, ":id")
	this.Data["Post"] = models.GetBlog(id)
	this.Layout = "layout.tpl"
	this.TplNames = "view.tpl"
}
예제 #3
0
func (this *EditController) Get() {
	if this.GetSession("root") == models.User && this.GetSession("passwd") == models.Password {
		var id int
		this.Ctx.Input.Bind(&id, ":id")
		this.Data["Post"] = models.GetBlog(id)
		this.Layout = "layout.tpl"
		this.TplNames = "edit.tpl"
	} else {
		this.Ctx.Redirect(302, "/404")
	}
}