Esempio n. 1
0
/**
 * 文章列表
 */
func (this *AdminController) List() {
	this.Data["Page_title"] = "文章列表"
	this.Data["Is_list"] = true
	page, _ := this.GetInt(":page")
	cnt := posts.Count()

	var getStart int64
	this.Data["NoPre"], this.Data["NoNext"], this.Data["PrePage"], this.Data["NextPage"], getStart = utils.PageInfo(page, models.ADMIN_PRE_NUM, cnt)
	ret := posts.GetAll(getStart, models.ADMIN_PRE_NUM)
	this.Data["Posts"] = ret
	this.Layout = "admin/layout.tpl"
	this.TplNames = "admin/list.tpl"
}
Esempio n. 2
0
/**
 * 根据分类获取列表
 */
func (this *PostController) ListByCate() {
	cid, _ := this.GetInt(":cid")
	page, _ := this.GetInt(":page")
	var getStart int64
	cnt := posts.CateCount(cid)
	this.Data["NoPre"], this.Data["NoNext"], this.Data["PrePage"], this.Data["NextPage"], getStart = utils.PageInfo(page, models.INDEX_PRE_NUM, cnt)
	this.Data["Posts"] = posts.GetByCate(cid, getStart, models.INDEX_PRE_NUM)
	this.Data["Cid"] = cid
	this.Data["BaseUrl"] = "/cate/" + strconv.Itoa(int(cid))
	this.TplNames = "index.tpl"
}
Esempio n. 3
0
/**
 * 根据月份获取列表
 */
func (this *PostController) ListByMonth() {
	month := this.GetString(":month")
	page, _ := this.GetInt(":page")
	var getStart int64
	cnt := posts.MonthCount(month)
	this.Data["NoPre"], this.Data["NoNext"], this.Data["PrePage"], this.Data["NextPage"], getStart = utils.PageInfo(page, models.INDEX_PRE_NUM, cnt)
	this.Data["Posts"] = posts.GetByMonth(month, getStart, models.INDEX_PRE_NUM)
	this.Data["BaseUrl"] = "/month/" + month
	this.TplNames = "index.tpl"
}
Esempio n. 4
0
/**
 * 获取所有记录
 */
func (this *PostController) Get() {
	//posts.RawGetAll()
	page, _ := this.GetInt(":page")

	cnt := posts.Count()

	var getStart int64
	this.Data["NoPre"], this.Data["NoNext"], this.Data["PrePage"], this.Data["NextPage"], getStart = utils.PageInfo(page, models.INDEX_PRE_NUM, cnt)
	this.Data["Is_index"] = true
	this.Data["BaseUrl"] = "/list"
	ret := posts.GetAll(getStart, models.INDEX_PRE_NUM)
	this.Data["Posts"] = ret
	this.TplNames = "index.tpl"
}