0
某次查询实现了以下功能便可以将page_html和result返回模板作为分页模板和分页数据
where = '`webid`=12' # 查询条件
page = 2 # 调用第几页数据
limit = 10 # 每页显示多少行数据
# 问题答案列表
result = self.db.list(
table="question_result",
field='answer',
where=where,
page=page,
limit=limit
)
if page and page > self.db.total_page:
page = self.db.total_page
result = self.db.list(
table="question_result",
field='answer',
where=where,
page=page,
limit=limit
)
from kyger.common import page_tpl
page_html = page_tpl(self.db.page, self.db.total_page, 10, self.kg['server'].get('WEB_URL')) # 获取分页模板
total_rows = self.db.total_rows # 总记录数
total_page = self.db.total_page # 总页数适应版本