Html_Menu - Assigning urls to nodes

From: Date: Wed, 26 May 2004 08:22:37 +0000
Subject: Html_Menu - Assigning urls to nodes
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-12740@lists.php.net to get a copy of this message
Hi, I am trying to use the Html_Menu class' example script: How can I change this line: foreach ($data as $id => $node) { $data[$id]['url'] = $_SERVER['PHP_SELFT']."?nodeID=".$node['id']; } so that i get actual links to different pages? When I change $_SERVER['PHP_SERVER'] to $data[$id]['url'] the links refer to different pages but the menu doesn't work anymore. Really, I am giving up. Tried all day yesterday.The documentation doesn't help at all. ... $params = array( 'id' => 'id', 'parent_id' => 'rootid', 'left_id' => 'l', 'right_id' => 'r', 'order_num' => 'norder', 'level' => 'level', 'id_trans' => 'id_trans', 'url' => 'url', 'name' => 'name', ); $nestedSet =& DB_NestedSet::factory('DB', $dsn, $params); // we want the nodes to be displayed ordered by name, so we add the secondarySort attribute $nestedSet->setAttr(array( 'node_table' => 'nested_set', 'lock_table' => 'nested_set_locks', 'secondarySort' => 'name', ) ); // get data (important to fetch it as an array, using the true flag) $data = $nestedSet->getAllNodes(true); // }}} // {{{ manipulate data // add links to each item foreach ($data as $id => $node) { $data[$id]['url'] = $_SERVER['php_self']."?nodeID=".$node['id']; } ...

« previous php.pear.general (#12740) next »