func (this *HomeController) Get() { this.Data["IsHome"] = true this.TplNames = "home.html" this.Data["IsLogin"] = checkAccount(this.Ctx) category := this.Input().Get("cate") var err error topics := make([]*models.Topic, 0) if len(category) == 0 { topics, err = models.GetAllTopics(true) } else { topics, err = models.GetTopicsByCategory(category, true) } if err != nil { beego.Error(err) } this.Data["Topics"] = topics Category, err := models.GetAllCategories() if err != nil { beego.Error(err) } this.Data["Categories"] = Category }
func (this *TopicController) Get() { this.Data["IsTopic"] = true this.Data["IsLogin"] = checkAccount(this.Ctx) this.TplNames = "topic.html" topics, err := models.GetAllTopics(false) if err != nil { beego.Error(err) } this.Data["Topics"] = topics }
func (this *HomeController) Get() { this.Data["IsHome"] = true this.TplNames = "home.html" this.Data["IsLogin"] = checkAccount(this.Ctx) topics, err := models.GetAllTopics(true) if err != nil { beego.Error(err) } this.Data["Topics"] = topics }
func (this *HomeController) Get() { this.Data["IsHome"] = true this.TplNames = "home.html" this.Data["IsLogin"] = checkAccount(this.Ctx) topics, err := models.GetAllTopics( this.Input().Get("cate"), this.Input().Get("lable"), true) if err != nil { beego.Error(err) } this.Data["Topics"] = topics categories, err := models.GetAllCategories() if err != nil { beego.Error(err) } this.Data["Categories"] = categories }
func (c *MainController) Get() { c.TplNames = "home.html" c.Data["IsHome"] = true c.Data["IsLogin"] = checkAccount(c.Ctx) topics, err := models.GetAllTopics(c.Input().Get("cate"), c.Input().Get("label"), true) if err != nil { beego.Error(err.Error()) } else { c.Data["Topics"] = topics } categories, err := models.GetAllCategories() if err != nil { beego.Error(err) } c.Data["Categories"] = categories }
func (c *MainController) Get() { c.Data["Website"] = "beego.me" c.Data["Email"] = "*****@*****.**" c.Data["IsHome"] = true c.Data["IsLogin"] = checkAccount(c.Ctx) topics, err := models.GetAllTopics(c.Input().Get("cate"), true) if err != nil { beego.Error(err) } else { c.Data["Topics"] = topics } c.TplName = "home.html" categories, err := models.GetAllCategories() if err != nil { beego.Error(err) } c.Data["Categories"] = categories }