From ce43496df3730014451524899eb3a5dcba6a9429 Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Tue, 14 Jul 2015 16:59:29 +0100 Subject: [PATCH] Bugfix get_subpages() and add subpage list to bottom of page --- core.php | 10 +++++----- index.php | 42 ++++++++++++++++++++++++++++++++-------- module_index.json | 6 +++--- modules/page-credits.php | 1 - modules/page-view.php | 24 +++++++++++++++++++++-- settings.fragment.php | 7 +++++++ testcheck.php | 34 -------------------------------- 7 files changed, 71 insertions(+), 53 deletions(-) delete mode 100644 testcheck.php diff --git a/core.php b/core.php index 8c1851a..7d2720b 100644 --- a/core.php +++ b/core.php @@ -77,20 +77,19 @@ function get_subpages($pageindex, $pagename) $result = new stdClass(); $stem = "$pagename/"; - $stem_length = stelen($stem); - foreach($pagenames as $entry) + $stem_length = strlen($stem); + foreach($pagenames as $entry => $value) { if(substr($entry, 0, $stem_length) == $stem) { // We found a subpage // Extract the subpage's key relative to the page that we are searching for - $subpage_relative_key = substr($item, $stem_length, -3); + $subpage_relative_key = substr($entry, $stem_length, -3); // Calculate how many times removed the current subpage is from the current page. 0 = direct descendant. $times_removed = substr_count($subpage_relative_key, "/"); - $subpage_full_key = substr($item, 0, -3); // Store the name of the subpage we found - $result->$subpage_full_key = $times_removed; + $result->$entry = $times_removed; } } @@ -282,6 +281,7 @@ class page_renderer public static $main_content_template = "{navigation-bar}

{sitename}

{content} +