DB_NestedSet with HTML Menu - Can I use URL filename without ID?
| From: | Mark Reynolds | Date: | Wed, 04 Jul 2007 09:31:28 +0000 |
| Subject: | DB_NestedSet with HTML Menu - Can I use URL filename without ID? | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-27622@lists.php.net to get a copy of this message | ||
Hi, I am using:
DB_NestedSet 1.3.6
HTML_Menu 2.1.3
These are the files that I'm utilising:
require_once('HTML/Menu.php');
require_once('DB/NestedSet.php');
require_once('DB/NestedSet/Output.php');
require_once('DB/NestedSet/Menu.php');
require_once ('HTML/Menu/DirectTreeRenderer.php');
I've been following this and a couple of other tutorials:
http://jystewart.net/process/2005/03/a-lengthier-introduction-to-db_nestedset/
http://trac.seagullproject.org/wiki/Howto/Navigation/HtmlMenu
The problem is that the majority of these tutorials seem to rely on the node
id being in the url in order to be able to use the PickNode function to
return the page's content. However I've been experimenting and have failed
to find a method whereby I can just make reference to the $node['name'] for
example and not the ID. JYStewart goes partly there, but instead of the
'option' directory name that Stewart uses I'm looking to include the root
name.
So if the $node['level'] is equal to 1 it displays the $node['name'] in the
URL.
eg. http://www.domain.com/root/
or if the $node['level'] is greater than 1 it displays the $node['name'] as
the filename plus it's root name as the 'directory'. I want to keep the url
down to this depth and not include subnodes etc.
eg. http://www.domain.com/root/leaf.htm
However I've been struggling with the detail/coding for this. So advice
would be appreciated on this.
Once the links are displayed correctly there's the important issue of
returning the $node[id'] based on the filename from the url, so that the ID
can be given to the PickNode function.
How can I carry the above out? Is it possible? Due to the lack of
documentation I've looked through the relevent pear files but unless I've
missed something there doesn't seem to be a function whereby I can input the
filename or similar?? Is there an option I can use that has already been
coded into the HTML MENU files for example, or do I have to change the code
within these files at some point?