Example #1
0
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"
}
Example #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
	}

}