Exemple #1
0
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"
}
Exemple #2
0
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()
}