func (this *TopicController) Tag() { tag := this.Ctx.Input.Param("0") topics, err := models.AllTopics(true, "", tag) if err != nil { beego.Error(err) } this.TplNames = "home.html" this.Data["headerTitle"] = "Home" this.Data["isLogin"] = checkLogin(this.Ctx) this.Data["isHome"] = true this.Data["Topics"] = topics this.Data["Tags"], err = models.AllTags() if err != nil { beego.Error(err) } }
func (this *MainController) Get() { this.TplNames = "home.html" this.Data["headerTitle"] = "Home" this.Data["isLogin"] = checkLogin(this.Ctx) this.Data["isHome"] = true var err error this.Data["Topics"], err = models.AllTopics(true, "", "") if err != nil { beego.Error(err) } this.Data["Tags"], err = models.AllTags() if err != nil { beego.Error(err) } }
func (this *TopicController) View() { this.TplNames = "topicView.html" this.Data["headerTitle"] = "View Topics" this.Data["isLogin"] = checkLogin(this.Ctx) this.Data["isTopic"] = true id := this.Ctx.Input.Param("0") topic, err := models.GetTopic(id) if err != nil { beego.Error(err) } comments, err := models.QueryCommentsByTid(id) if err != nil { beego.Error(err) } this.Data["Topic"] = topic this.Data["Comments"] = comments this.Data["Tags"], err = models.AllTags() if err != nil { beego.Error(err) } }