iliaa Wed Sep 14 18:02:39 2005 EDT
Modified files: /livedocs livedoc_funcs.php Log: Place extension's function list at the top of the nav bar. # Credit and Thanks goes out to Sean http://cvs.php.net/diff.php/livedocs/livedoc_funcs.php?r1=1.30&r2=1.31&ty=u Index: livedocs/livedoc_funcs.php diff -u livedocs/livedoc_funcs.php:1.30 livedocs/livedoc_funcs.php:1.31 --- livedocs/livedoc_funcs.php:1.30 Thu Jul 14 15:05:38 2005 +++ livedocs/livedoc_funcs.php Wed Sep 14 18:02:38 2005 @@ -24,9 +24,6 @@ if (!defined('NAV_END')) { define('NAV_END', "</table>\n"); } -if (!defined('NAV_CHILDREN_EMBEDED')) { - define('NAV_CHILDREN_EMBEDED', false); -} if (!function_exists('nav_item')) { function nav_item($data, $class ) { return "<tr><td class='$class'>$data</td></tr>\n"; @@ -39,7 +36,8 @@ function do_nav($idx, $fb_idx, $lang, $current_page, &$nav, &$children) { $children = array(); - $nav = NAV_START; + $nav_start = NAV_START; + $nav = ''; /* Get the fileinfo for the reference */ $current_page = sqlite_escape_string($current_page); @@ -61,36 +59,29 @@ if (($r = sqlite_single_query($idx, "SELECT path FROM toc WHERE docbook_id = '$current_page' LIMIT 1"))) { $path = explode(",", $r); foreach ($path as $item) { - $nav .= do_nav_line($item, $head_class, $current_page, $lang, $dummy); + $nav_start .= do_nav_line($item, $head_class, $current_page, $lang, $dummy); $last_item = $item; $head_class = 'header up'; } } else { - $nav .= do_nav_line(ROOT_NODE, 'up', $current_page, $lang, $dummy); + $nav_start .= do_nav_line(ROOT_NODE, 'up', $current_page, $lang, $dummy); } $after_child_class = ''; /* With $last_item we're going to show all brothers */ $r = (array) sqlite_single_query($idx, "SELECT docbook_id FROM toc WHERE parent_docbook_id = '$last_item' ORDER BY id"); foreach ($r as $val) { - $nav .= do_nav_line($val, 'down'.$after_child_class, $current_page, $lang, $dummy); - $after_child_class = ''; - /* Include the children here */ - if (NAV_CHILDREN_EMBEDED && $current_page == $val) { - do_nav_children($idx, $val, $lang, $current_page, $nav, $children); + if ($current_page == $val) { + $nav_start .= do_nav_line($current_page, 'down active', $current_page, $lang, $dummy); + do_nav_children($idx, $val, $lang, $current_page, $nav_start, $children); } - - } - - /* And finally all children, but only if $current_page != $last_item - * because showing the same thing twice makes no sense */ - if ( !NAV_CHILDREN_EMBEDED && $current_page != $last_item) { - do_nav_children($idx, $val, $lang, $current_page, $nav, $children); + $nav .= do_nav_line($val, 'down'.$after_child_class, $current_page, $lang, $dummy); + $after_child_class = ''; + } - - $nav .= NAV_END; + $nav = $nav_start . $nav . NAV_END; return $tr[0]; }