Skip to content
Browse files

Add page.next_siblings and page.previous_siblings

  • Loading branch information...
1 parent 3de6607 commit a7c19e8e99fcce4323f02092bad91ea911e274ee @mavdhe mavdhe committed Apr 24, 2012
Showing with 4 additions and 0 deletions.
  1. +4 −0 app/page-data.inc.php
View
4 app/page-data.inc.php
@@ -157,6 +157,10 @@ static function create_collections($page) {
$page->siblings = Helpers::list_files($parent_path, '/^\d+?\.(?!'.$split_url[(count($split_url) - 1)].')/', true);
# page.siblings_and_self
$page->siblings_and_self = Helpers::list_files($parent_path, '/^\d+?\./', true);
+ # page.next_siblings / page.previous_siblings
+ $index = self::get_index($page->data['siblings_and_self'], $page->file_path);
+ $page->previous_siblings = array_slice($page->data['siblings_and_self'], 0, $index, true);
+ $page->next_siblings = array_slice($page->data['siblings_and_self'], $index, count($page->data['siblings_and_self']), true);
# page.next_sibling / page.previous_sibling
$neighboring_siblings = self::extract_closest_siblings($page->data['siblings_and_self'], $page->file_path);
$page->previous_sibling = array($neighboring_siblings[0]);

0 comments on commit a7c19e8

Please sign in to comment.
Something went wrong with that request. Please try again.