HTML_Menu throwing notices
| From: | Jeroen Houben | Date: | Mon, 10 May 2004 12:46:29 +0000 |
| Subject: | HTML_Menu throwing notices | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-12387@lists.php.net to get a copy of this message | ||
Hi,
Just trying to get the example at http://pear.php.net/manual/en/package.html.html-menu.intro.php to work.
It does work but also throws me a notice:
Notice: Undefined index: in /usr/local/share/php/pear/HTML/Menu.php on line 462
I guess there's some array key missing but I cannot spot it..
Here's the code:
<?php
// Load the class
require_once 'HTML/Menu.php';
$data = array(
1 => array(
'title' => 'Menu item 1',
'url' => '/item1.php',
'sub' => array(
11 => array('title' => 'Menu item 1.1', 'url' => '/item1.1.php'),
12 => array(
'title' => 'Menu item 1.2',
'url' => '/item1.2.php',
'sub' => array(
121 => array('title' => 'Menu item 1.2.1', 'url' => '/item1.2.1.php'),
122 => array('title' => 'Menu item 1.2.2', 'url' => '/item1.2.2.php')
)
)
)
),
2 => array(
'title' => 'Menu item 2',
'url' => '/item2.php',
'sub' => array(
21 => array('title' => 'Menu item 2.1', 'url' => '/item2.1.php'),
22 => array('title' => 'Menu item 2.2', 'url' => '/item2.2.php')
)
)
);
// Instantiate the menu object, we presume that $data contains menu structure
$menu =& new HTML_Menu($data, 'sitemap');
// Output the menu
$menu->show();
?>