Jump to content

Extension talk:Hierarchy/Hierarchy.php

Add topic
From mediawiki.org

If somebody has some issues about displaying subordinate pages in the navigation box, this code might help you out.

In the file Hierarchy.php, replace this code


$parent_id[$toclevel] = $current_article_id;
if ($toclevel > $max_level) $max_level = $toclevel;
for ($i = $toclevel + 1; $i <= $max_level; $i++) {
    $parent_id[$i] = 0;  // clear lower levels to prevent using an old value in case some intermediary levels are omitted
}
$parentArticleId = $parent_id[$toclevel - 1];
$parentArticleId = intval($parentArticleId);


By this one

$parent_id[$TOC_number] = $current_article_id;
if(strlen($TOC_number)==1)
     $parentArticleId = $root_article_id;
else{
    $previoustoc = substr($TOC_number, 0, strlen($TOC_number)-2);
    $parentArticleId = $parent_id[$previoustoc];
}

Start a discussion about Extension:Hierarchy/Hierarchy.php

Start a discussion