コード例 #1
0
ファイル: topicController.go プロジェクト: zhao-l-c/goblog
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
ファイル: topicController.go プロジェクト: zhao-l-c/goblog
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
ファイル: topicController.go プロジェクト: zhao-l-c/goblog
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
ファイル: homeController.go プロジェクト: zhao-l-c/goblog
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)
	}
}