|
| 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'];
}
....
|
|