Example #1
0
func ViewBlog(ctx *middleware.Context, params martini.Params) {
	id := params["id"]
	blog := new(model.Blog)
	blog.Id = ParseInt(id)
	err := blog.GetBlog()
	blog.Visit += 1
	blog.UpdateVisit()
	PanicIf(err)
	ctx.Set("Blog", blog)

	tags, err := blog.GetAllTags()
	PanicIf(err)
	ctx.Set("Tags", tags)

	ctx.HTML(200, "blog/view", ctx)
}