summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--inc/html.php11
1 files changed, 6 insertions, 5 deletions
diff --git a/inc/html.php b/inc/html.php
index 64999ed98..6e9cce7df 100644
--- a/inc/html.php
+++ b/inc/html.php
@@ -782,16 +782,17 @@ function html_buildlist($data,$class,$func,$lifunc='html_li_default'){
return '';
}
- $level = $data[0]['level'];
- $opens = 0;
+ $start_level = $data[0]['level'];
$ret = '';
- if ($level < 2) {
+ if ($start_level < 2) {
// Trigger building a wrapper ul if the first level is
// 0 (we have a root object) or 1 (just the root content)
- --$level;
+ --$start_level;
}
+ $level = $start_level;
+
foreach ($data as $item){
if( $item['level'] > $level ){
@@ -824,7 +825,7 @@ function html_buildlist($data,$class,$func,$lifunc='html_li_default'){
}
//close remaining items and lists
- for ($i=0; $i < $level; $i++){
+ while(--$level >= $start_level) {
$ret .= "</li></ul>\n";
}