$step = 10; $page = isset($_GET['p']) ? $_GET['p'] : 1; if ($page <= 1) { $start = 0; $stop = $start + $step; $to_back = false; if ($maxpages > 1) { $to_next = true; } } else { $start = $page * $step; $stop = $start + $step; $to_next = false; $to_back = true; } $arrLastItems = $cData->get_items(null, "NOW", null, "pubdate_int", "DESC", $start, 50); $intLastItems = count($arrLastItems); $maxpages = $intLastItems / $step; if ($page > $maxpages) { $page = $maxpages; } if ($page <= 1) { $start = 0; $stop = $start + $step; $to_back = false; if ($maxpages > 1) { $to_next = true; } } else { $start = $page * $step; $stop = $start + $step;
} } else { $intStart = $intPage * $intStep - $intStep; $intStop = $intStart + $intStep; $to_next = false; $to_back = true; if ($intMaxPages > $intPage) { if ($intStop < $intFeedItems) { $to_next = true; } } } $but_to_back = $to_back ? "<a href='/feed/{$intFeedID}-" . ($intPage - 1) . ".html'>< Back</a> " : null; $but_to_next = $to_next ? "<a href='/feed/{$intFeedID}-" . ($intPage + 1) . ".html'>Next ></a>" : null; $arrFeed = $cData->get_feed($intFeedID); $arrItems = $cData->get_items($intFeedID, "NOW", null, "`pubdate_int`", "DESC", $intStart, 20); $intItems = count($arrItems); $feed_id = $arrFeed->feed_id; $feed_url = $arrFeed->url; $feed_link = $arrFeed->link; $feed_title = $arrFeed->title != "" ? $arrFeed->title : "unknown"; for ($c = 0; $intItems > $c; $c++) { $item_title = $arrItems[$c]->title; $item_link = $arrItems[$c]->link; $item_id = $arrItems[$c]->item_id; // $item_descr = $arrItems[$c]->description; //$item_pubdate = $chi['items'][$c]['pubDate']; // $item_pubdate = date("Y.m.d, h:i:s", strtotime($arrItems[$c]->pubdate_int)); $item_pubDate = date('d.m.Y h:i', strtotime($arrLastItems[$c]->pubdate_int)); $item_category = $arrItems[$c]->category; $item_comments = $arrItems[$c]->comments ? "<a href='" . $arrItems[$c]->comments . "'>Comments</a>" : null;