func (this *TopicController) Category() { category := this.Ctx.Input.Param("0") topics, err := models.AllTopics(true, category, "") 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 }
func (this *TopicController) Get() { this.TplNames = "topic.html" this.Data["headerTitle"] = "Topics" this.Data["isLogin"] = checkLogin(this.Ctx) this.Data["isTopic"] = true // TODO // SetCommonData(this, "topic.html", "isTopic", "文章") var err error this.Data["Topics"], err = models.AllTopics(true, "", "") if err != nil { beego.Error(err) } }
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) } }