Ejemplo n.º 1
0
func (this *TopicController) View() {

	var err error
	this.Data["Topic"], err = models.GetOneTopicAndCategory(this.Input().Get("id"))

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

	topic, _ := models.GetOneTopicAndCategory(this.Input().Get("id"))

	this.Data["CategoryTopics"], err = models.GetTopicByCategoryId(topic[0]["cid"], topic[0]["id"])

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

	this.Data["Replys"], err = models.GetTopicReplyByTopicId(this.Input().Get("id"))

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

	this.Data["PageTitle"] = "View Topic"
	this.Layout = "layout/layout.tpl"
	this.TplNames = "topic/view.tpl"
}
Ejemplo n.º 2
0
func (this *CategoryController) Get() {

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

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

	this.Data["Topics"], err = models.GetTopicByCategoryId(this.Input().Get("id"), "")

	if err != nil {
		beego.Error(err)
	}
	this.Data["PageTitle"] = "Category List"
	this.Layout = "layout/layout.tpl"
	this.TplNames = "category/index.tpl"
}