From 2d0aad96d70908548055f4040af502221c961553 Mon Sep 17 00:00:00 2001 From: Kanti Date: Fri, 31 Oct 2014 18:35:00 +0100 Subject: [PATCH] Added page parameter to /api/json --- system/htmly.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/system/htmly.php b/system/htmly.php index 5ba5c15..b0fb809 100644 --- a/system/htmly.php +++ b/system/htmly.php @@ -1200,8 +1200,11 @@ get('/api/json', function() { header('Content-type: application/json'); - // Print the 10 latest posts as JSON - echo generate_json(get_posts(null, 1, config('json.count'))); + $page = from($_GET, 'page'); + $page = $page ? (int) $page : 1; + $perpage = config('json.count'); + + echo generate_json(get_posts(null, $page, $perpage)); }); // Show the RSS feed