Date: 07/12/00
- Next message: kk: "[phplib-dev] cvs commit"
- Previous message: ssilk: "[phplib-dev] cvs commit"
- Next in thread: kk: "[phplib-dev] cvs commit"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
From: kk
Date: Wed Jul 12 13:05:17 2000
Modified files:
php-lib/php/html/menu.inc
Log message:
- added a sitemap function to the menu class.
Index: php-lib/php/html/menu.inc
diff -u php-lib/php/html/menu.inc:1.1 php-lib/php/html/menu.inc:1.2
--- php-lib/php/html/menu.inc:1.1 Thu Apr 13 15:28:48 2000
+++ php-lib/php/html/menu.inc Wed Jul 12 13:05:15 2000
@@ -5,7 +5,7 @@
* Copyright (c) 1999 NetUSE GmbH
* Kristian Koehntopp
*
- * $Id: menu.inc,v 1.1 2000/04/13 13:28:48 kk Exp $
+ * $Id: menu.inc,v 1.2 2000/07/12 11:05:15 kk Exp $
*
*/
class Menu {
@@ -83,6 +83,48 @@
return $str;
}
+
+ /*
+ * public: show a sitemap
+ */
+
+ function show_sitemap() {
+ print $this->get_sitemap();
+ }
+
+ function get_sitemap() {
+ $this->visible = array();
+
+ # Using PHP4, this could be faster, but we want to be portable.
+ reset($this->item);
+ while(list($k, $v) = each($this->item)) {
+ $this->visible[] = $k;
+ }
+ sort($this->visible);
+
+ # create them
+ $str = "";
+
+ $start = $this->nomain?1:0;
+ $len = count($this->visible);
+ $oldlevel = 0;
+ $str .= $this->start_menu();
+ for($i=$start; $i<$len; $i++) {
+ $level = count(explode("/", $this->visible[$i]));
+
+ if ($level > $oldlevel)
+ $str .= $this->shift_in($oldlevel, $level);
+ if ($level < $oldlevel)
+ $str .= $this->shift_out($oldlevel, $level);
+ $oldlevel = $level;
+
+ $str .= $this->get_cell($i, $level, $this->class);
+ }
+ $str .= $this->end_menu();
+
+ return $str;
+ }
+
/* public: show a single menu cell
*/
---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-dev-unsubscribe <email protected>
For additional commands, e-mail: phplib-dev-help <email protected>
- Next message: kk: "[phplib-dev] cvs commit"
- Previous message: ssilk: "[phplib-dev] cvs commit"
- Next in thread: kk: "[phplib-dev] cvs commit"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

