mirror of
https://github.com/danpros/htmly.git
synced 2026-04-22 13:36:22 +05:30
Added page parameter to /api/json
This commit is contained in:
parent
4f1150e842
commit
2d0aad96d7
1 changed files with 5 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue