예제 #1
0
파일: home.go 프로젝트: Everything2014/blog
func (this *HomeController) Get() {

	var err error
	this.Data["Topics"], err = models.GetAllTopic()

	if err != nil {
		beego.Error(err)
	}

	this.Data["Categories"], err = models.GetAllCategories()

	if err != nil {
		beego.Error(err)
	}
	this.Data["PageTitle"] = "Home"
	this.Layout = "layout/layout.tpl"
	this.TplNames = "home/index.tpl"
}
예제 #2
0
func (this *AdminTopicController) Get() {

	if isSignIn, admin := CheckAccount(this.Ctx); isSignIn {

		var err error
		this.Data["Topics"], err = models.GetAllTopic()

		if err != nil {
			beego.Error(err)
		}

		this.Data["IsTopic"] = true
		this.Data["PageTitle"] = "Topic Manager"
		this.Data["Admin"] = admin
		this.Layout = "layout/admin_layout.tpl"
		this.TplNames = "admin_topic/index.tpl"
	} else {
		this.Redirect("/adminlogin", 301)
		return
	}

}