HTML_Menu - Problem with external links
| From: | Leonie | Date: | Fri, 11 Jun 2004 12:06:21 +0000 |
| Subject: | HTML_Menu - Problem with external links | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-13099@lists.php.net to get a copy of this message | ||
After an awful lot of fiddling about I've discovered how to get the menu to
find the active link as well as ensure that it appends the correct path to
the links:
eg:
1 Home index.htm
2 Services services/index.htm
21 Services|Domains services/domains.htm
3 My Blog http://mungbeans.typepad.com/pear
4 About about.htm
I've used this code (or something pretty near to it without getting too
detailed):
$CURR_HOST = http://pear.mungbeans.com.au/;
$CURR_DOC = "services/index.htm";
$menu =& new HTML_Menu($menudata);
$menu->setURLPrefix($CURR_HOST);
$menu->forceCurrentUrl($CURR_HOST . $CURR_DOC);
I needed the $menu->setURLPrefix($CURR_HOST) to ensure that the correct
directory structure was adhered to. Without this the menu url is just
appended to the current directory (eg.: all the menus for documents in the
services directory show the path http://pear.mungbeans.com.au/services as a
prefix) which throws all the menu items out.
The setURLPrefix works well in this case except for external URLs. In the
above example the menu item
http://mungbeans.typepad.com/pear is rendered as
http://pear.mungbeans.com.au/http://mungbeans.typepad.com/pear.
Does this mean I can't use external links in HTML_Menu menus?
Leonie