From 78d7a965591bdc9d70ef2275b310940b4d58fc52 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 18 Dec 2009 15:08:38 +0300 Subject: [PATCH] mobile: implement pagination for headlines --- mobile/feed.php | 3 ++- mobile/functions.php | 42 ++++++++++++++++++++++++++++++------------ 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/mobile/feed.php b/mobile/feed.php index 610dd6adf..02461b3f6 100644 --- a/mobile/feed.php +++ b/mobile/feed.php @@ -22,7 +22,8 @@ $feed_id = db_escape_string($_REQUEST["id"]); $cat_id = db_escape_string($_REQUEST["cat"]); + $offset = (int) db_escape_string($_REQUEST["skip"]); - render_headlines_list($link, $feed_id, $cat_id); + render_headlines_list($link, $feed_id, $cat_id, $offset); ?> diff --git a/mobile/functions.php b/mobile/functions.php index 20accdc5e..4880e1f57 100644 --- a/mobile/functions.php +++ b/mobile/functions.php @@ -284,10 +284,10 @@ print ""; } - function render_headlines_list($link, $feed_id, $cat_id) { + function render_headlines_list($link, $feed_id, $cat_id, $offset) { $feed_id = $feed_id; - $limit = 30; + $limit = 15; $filter = ''; $is_cat = false; $view_mode = 'adaptive'; @@ -297,23 +297,27 @@ $search = ''; $search_mode = ''; $match_on = ''; - + $qfh_ret = queryFeedHeadlines($link, $feed_id, $limit, - $view_mode, $is_cat, $search, $search_mode, $match_on); + $view_mode, $is_cat, $search, $search_mode, $match_on, false, $offset); $result = $qfh_ret[0]; $feed_title = $qfh_ret[1]; - if ($cat_id) { - $cat_title = getCategoryTitle($link, $cat_id); + if (!$offset) { + if ($cat_id) { + $cat_title = getCategoryTitle($link, $cat_id); - print "