Hi. Can someone sell me how I would modify this to enclose in a div? It gets some sort of weird nested boxes so must be doing something wrong.
$info = show_menu2(0, SM2_CURR, SM2_START, SM2_ALL|SM2_BUFFER, '[if(class==menu-current){[level] [sib] [sibCount] [parent]}]', '', '', '');
list($nLevel, $nSib, $nSibCount, $nParent) = explode(' ', $info);
if ($nLevel > 0) {
$lev = $nLevel - 1;
return show_menu2(0, SM2_ROOT, SM2_CURR, SM2_CRUMB|SM2_BUFFER, "[if(level==$lev){[a][menu_title]</a>}]", '', '<div class="kb_submenu"><br />', '</div>');
}
Thank you.
Just a bit more info it generates multiple instances of the div
$info = show_menu2(0, SM2_CURR, SM2_START, SM2_ALL|SM2_BUFFER, '[if(class==menu-current){[level] [sib] [sibCount] [parent]}]', '', '', '');
list($nLevel, $nSib, $nSibCount, $nParent) = explode(' ', $info);
if ($nLevel > 0) {
$lev = $nLevel - 1;
return show_menu2(0, SM2_ROOT, SM2_CURR, SM2_CRUMB|SM2_BUFFER, "[if(level==$lev){[a][menu_title]</a>}]", '', '<div class="kb_submenu">', '</div>');
}
else
return '';
<div class="kb_submenu">
<div class="kb_submenu">
<a target="_top" href="http://allfrom1supply.net/kb/pages/roll-door-coatings/chem-bake-8000.php">Chem-Bake 8000</a>
<div class="kb_submenu">
</div>
</div>
</div>
I just want to surround the parent link with the div and class so I can style it. I can put the code for the div in the page but other users will be using this so I prefer they just copy in the [[droplet call]].
Thanks.
Try this:
<?php
$info = show_menu2(0, SM2_CURR, SM2_START, SM2_ALL|SM2_BUFFER, '[if(class==menu-current){[level] [sib] [sibCount] [parent]}]', '', '', '');
list($nLevel, $nSib, $nSibCount, $nParent) = explode(' ', $info);
if ($nLevel > 0) {
$lev = $nLevel - 1;
$parent = show_menu2(0, SM2_ROOT, SM2_CURR, SM2_CRUMB|SM2_BUFFER, "[if(level==$lev){[a][menu_title]</a>}]", '', '', '');
if($parent)
return '<div class="kb_submenu">'.$parent.'</div>';
}
return true;
Thanks Ruud. That works. :)