func (this *HomeController) ArticleDetail() { id, _ := strconv.Atoi(this.Ctx.Input.Param(":id")) article := new(models.Article) err := article.GetArticleInfo(id) if err != nil { fmt.Println(err) } this.Data["article"] = article this.TplNames = "front/articledetail.tpl" }
func (this *ArticleController) GetData() { id, _ := strconv.Atoi(this.Ctx.Input.Param(":id")) article := new(models.Article) err := article.GetArticleInfo(id) if err != nil { fmt.Println(err) } fmt.Println(article) this.Data["json"] = article this.ServeJson() }