diff --git a/index.php b/index.php index 732c3b1..20756a7 100644 --- a/index.php +++ b/index.php @@ -105,7 +105,7 @@ Router\get_action('show', function() { $nav = Model\get_nav_item($item, array('read')); break; case 'feed-items': - $nav = Model\get_nav_item($item, array('unread', 'read')); + $nav = Model\get_nav_item($item, array('unread', 'read'), array(1, 0), $item['feed_id']); break; case 'bookmarks': $nav = Model\get_nav_item($item, array('unread', 'read'), array(1)); diff --git a/model.php b/model.php index 458ef85..d0a6510 100644 --- a/model.php +++ b/model.php @@ -482,14 +482,17 @@ function get_item($id) } -function get_nav_item($item, $status = array('unread'), $bookmark = array(1, 0)) +function get_nav_item($item, $status = array('unread'), $bookmark = array(1, 0), $feed_id = null) { - $items = \PicoTools\singleton('db') + $query = \PicoTools\singleton('db') ->table('items') ->columns('id', 'status', 'title', 'bookmark') ->neq('status', 'removed') - ->desc('updated') - ->findAll(); + ->desc('updated'); + + if ($feed_id) $query->eq('feed_id', $feed_id); + + $items = $query->findAll(); $next_item = null; $previous_item = null;