diff options
author | Kate Arzamastseva <pshns@ukr.net> | 2011-07-15 00:16:07 +0300 |
---|---|---|
committer | Kate Arzamastseva <pshns@ukr.net> | 2011-07-15 00:16:07 +0300 |
commit | 3dd4a911f6492d9dce2b58bcd44c917489f50301 (patch) | |
tree | 3bae66359cf2957253740e1dac6fae74b0e3cd15 /inc/html.php | |
parent | c439558b00bf5429e11461bc999b63a22f066ac1 (diff) | |
parent | 1e542e417725bb148253929fac9146832d978e45 (diff) | |
download | rpg-3dd4a911f6492d9dce2b58bcd44c917489f50301.tar.gz rpg-3dd4a911f6492d9dce2b58bcd44c917489f50301.tar.bz2 |
Merge branch 'master' of git://github.com/splitbrain/dokuwiki into media-revisions
Diffstat (limited to 'inc/html.php')
-rw-r--r-- | inc/html.php | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/inc/html.php b/inc/html.php index df28a2096..b4cf27d61 100644 --- a/inc/html.php +++ b/inc/html.php @@ -807,7 +807,7 @@ function html_list_index($item){ /** * Index List item * - * This user function is used in html_build_lidt to build the + * This user function is used in html_buildlist to build the * <li> tags for namespaces when displaying the page index * it gives different classes to opened or closed "folders" * @@ -848,10 +848,20 @@ function html_li_default($item){ * @author Andreas Gohr <andi@splitbrain.org> */ function html_buildlist($data,$class,$func,$lifunc='html_li_default'){ - $level = 0; + if (count($data) === 0) { + return ''; + } + + $level = $data[0]['level']; $opens = 0; $ret = ''; + if ($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; + } + foreach ($data as $item){ if( $item['level'] > $level ){ @@ -867,7 +877,7 @@ function html_buildlist($data,$class,$func,$lifunc='html_li_default'){ //close higher lists $ret .= "</ul>\n</li>\n"; } - }else{ + } elseif ($ret !== '') { //close last item $ret .= "</li>\n"; } |