Exemple #1
0
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
}
Exemple #2
0
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)
	}
}
Exemple #3
0
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)
	}
}
Exemple #4
0
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)
	}
}