I'm doing a site that's primary goal is to sell products to punters. Products are in a range of categories that are children of a top level page/menuitem called 'Products'. I want those categories to be always expanded on the left side 'bulletmenu' regardless of where in the site the visitor is browsing...
so I came up with an 'always_expanded' extension to the {bulletmenu} tag. My implementation goes something like this....
1) at about line 31 of function.bulletmenu.php, add the following:
Code: Select all
$always_expand = isset($params['always_expand']) ? $params['always_expand'] : 0 ;
$always_expand .= '.';
Code: Select all
if (substr($onecontent->Hierarchy(), 0, strlen($always_expand)) == $always_expand) {
$remainder = substr($onecontent->Hierarchy(), (strlen($always_expand)));
$log->debug('remainder: ' . $remainder);
if (strpos($remainder, '.') == false) {
$log->debug('Setting skipme to false (always_expand)');
$skipme = false;
continue;
}
}
Code: Select all
{bulletmenu always_expand="2"}
... and enjoy...
In a nutshell, it works by looking at the current level in the heirarchy of things that are set to be not displayed ('$skipme') and checks to see if they are an immediate child of the menuitem specified by always_expand. If they are, it resets skipme to false, and {bulletmenu ...} goes on to display the item.
I've made no attempt to trap errors, etc - it rates as quick hack, not necessarily production quality. This works ok for me, I don't promise it won't break for you
Potential future improvement, allow more than one menuitem to be 'always_expand'ed. Only one is possible by this current method.
I hope this is useful to someone.
Geoff
(sonicGB on #cms)