Beispiel #1
0
//文章列表
func (this *Article) ArticleList() {
	this.TplNames = "article_list.html"

	currentPage := 1
	//获取上一页的页码
	if page, err := strconv.Atoi(this.Input().Get("p")); err == nil {
		currentPage = page
	}

	this.Data["isArticle"] = true
	var count int64
	this.Data["topics"], count = article.GetAllArticles(limit, currentPage)
	pagination.SetPaginator(this.Ctx, limit, count)
}
Beispiel #2
0
func (this *Home) Index() {
	this.TplNames = "home.html"
	this.Data["Title"] = "首页"

	currentPage := 1
	//获取上一页的页码
	if page, err := strconv.Atoi(this.Input().Get("p")); err == nil {
		currentPage = page
	}

	articleList, count := article.GetAllArticles(pageLimit, currentPage)

	pagination.SetPaginator(this.Ctx, pageLimit, count)

	this.Data["topicList"] = articleList

	this.Data["categoryList"] = article.GetCategories(false)
}