cvs: pearweb /include pear-category.php
| From: | Thomas V.V.Cox | Date: | Mon, 10 Sep 2001 13:34:00 +0000 |
| Subject: | cvs: pearweb /include pear-category.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-826@lists.php.net to get a copy of this message | ||
cox Mon Sep 10 09:34:00 2001 EDT
Modified files:
/pearweb/include pear-category.php
Log:
added get_categories_menu() that returns the html needed for printing
the menu (tested menu types: tree and urhere)
Index: pearweb/include/pear-category.php
diff -u pearweb/include/pear-category.php:1.3 pearweb/include/pear-category.php:1.4
--- pearweb/include/pear-category.php:1.3 Sat Sep 8 08:45:21 2001
+++ pearweb/include/pear-category.php Mon Sep 10 09:33:59 2001
@@ -2,7 +2,7 @@
require 'HTML/Menu.php';
/*
Transform the tree of categories in an assoc array
-valid for the Menu Class
+valid for the Ulf's Menu Class
*/
function &tree_to_menu ($tnode, $mpid) {
global $tree;
@@ -22,8 +22,8 @@
/*
Returns the html needed to print in the category selection page
*/
-function &cat_selector () {
- global $dbh, $tree;
+function initialize_categories_menu () {
+ global $dbh, $tree, $menu;
if (empty($dbh)) {
include_once 'DB.php';
PEAR::setErrorHandling(PEAR_ERROR_DIE);
@@ -43,7 +43,15 @@
$menu[1] = tree_to_menu(0,'1');
$menu[1]['url'] = $GLOBALS['PHP_SELF'];
- $m = new HTML_Menu ($menu, 'tree', 'REQUEST_URI');
+}
+
+function &get_categories_menu($type = 'tree') {
+ global $menu;
+ if (empty($menu)) {
+ initialize_categories_menu();
+ }
+ $m = new HTML_Menu ($menu, $type, 'REQUEST_URI');
return $m->get();
}
+
?>