HTML_TreeMenu
| From: | Blaine Lang | Date: | Fri, 20 Jun 2003 03:30:39 +0000 |
| Subject: | HTML_TreeMenu | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-6140@lists.php.net to get a copy of this message | ||
I've been checking out the HTML_TreeMenu package and so far really like it.
I had a couple questions that I was hoping someone could help me with.
I have the class working in a recursive function that will create a tree
menu for a directory listing creating the folders for sub directories and
changing icons for file types. This is a test app for a project I want to
work on.
This is not the actual code but I was having an issue with trying to handle
the first ->additem method. It does not want to be used within the function
I have. I have subsequent ->additems calls in the same function and they
work fine - it handles all the resursive directories ok.
I get : Fatal error: Call to a member function on a non-object
It would appear to be an issue with address pointer to the class object but
the calls work fine in the function for all subsequent calls just not the
first ->addItem,
To simulate the error I have the following extract. Since I need to pass
$nodel to the function which picks it up as an address - function
showfoldertree(&$treeclass,$rootdir,$files,$baseurl) {
Why would this snippet of logic not work
Assign $test to the address and then instead of
$foo = &$nodel->addItem(new ... use $foo = $test->addItem(new ...
$menu = new HTML_TreeMenu();
$node1 = new HTML_TreeNode(array('text' => $rootdir ,'link' => $baseurl
,'icon' => $folder_icon));
$test = &$nodel;
$foo = $test->addItem(new HTML_TreeNode(array('text' => $subdir,'link'
=>
$baseurl.$subdir,'icon' => $folder_icon)));
showfoldertree($foo,$rootdir,$filelisting,$baseurl);
Any help would be appreciated
Blaine