某次查詢實(shí)現(xiàn)了以下功能便可以將page_html和result返回模板作為分頁模板和分頁數(shù)據(jù)
where = '`webid`=12' # 查詢條件 page = 2 # 調(diào)用第幾頁數(shù)據(jù) limit = 10 # 每頁顯示多少行數(shù)據(jù) # 問題答案列表 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 # 總記錄數(shù) total_page = self.db.total_page # 總頁數(shù)適應(yīng)版本