コード例 #1
0
ファイル: content.go プロジェクト: zacklin923/GoCMS
//内容管理列表
func (c Content) List(article *models.Article) revel.Result {

	title := "内容--GoCMS管理内容"

	var cid string = c.Params.Get("cid")
	var page string = c.Params.Get("page")
	var search string = c.Params.Get("search")

	Cid, err := strconv.ParseInt(cid, 10, 64)
	if err != nil {
		revel.WARN.Println(err)
	}

	category := new(models.Category)
	categorys := category.GetCateGoryOptionHtml(0)

	if len(page) > 0 {
		Page, err := strconv.ParseInt(page, 10, 64)
		if err != nil {
			revel.WARN.Println(err)
		}

		article_list, pages, where := article.GetByAll(search, Cid, Page, 10)

		c.Render(title, cid, categorys, article_list, where, pages)
	} else {
		article_list, pages, where := article.GetByAll(search, Cid, 1, 10)

		c.Render(title, cid, categorys, article_list, where, pages)
	}

	return c.RenderTemplate("Content/Manage/Index.html")
}