コード例 #1
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)
	}
}
コード例 #2
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)
	}
}
コード例 #3
0
ファイル: topicController.go プロジェクト: zhao-l-c/goblog
func (this *TopicController) View() {
	this.TplNames = "topicView.html"
	this.Data["headerTitle"] = "View Topics"
	this.Data["isLogin"] = checkLogin(this.Ctx)
	this.Data["isTopic"] = true

	id := this.Ctx.Input.Param("0")
	topic, err := models.GetTopic(id)
	if err != nil {
		beego.Error(err)
	}
	comments, err := models.QueryCommentsByTid(id)
	if err != nil {
		beego.Error(err)
	}
	this.Data["Topic"] = topic
	this.Data["Comments"] = comments
	this.Data["Tags"], err = models.AllTags()
	if err != nil {
		beego.Error(err)
	}
}