示例#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
}
示例#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)
	}
}
示例#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)
	}
}
示例#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)
	}
}