WebsiteBaker 2.13.8 is now available!
R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WBhttps://forum.websitebaker.org/index.php/topic,32355.0.html
$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);// show up levelif ($nLevel > 0) {$lev = $nLevel - 1;return show_menu2(0, SM2_ROOT, SM2_CURR, SM2_CRUMB|SM2_BUFFER, "[if(level==$lev){[ul][li][a][menu_title]</a></li></ul>}]", '', '', '');}else {return show_menu2(0, SM2_ROOT, SM2_CURR, SM2_CRUMB|SM2_BUFFER);}
If you don't want to show anything if there is no parent page, replace the last line in return ' '; (Return a single whitespace)
Hi Argos,right, a link to itself. The reason is simple: I use this for a side menu. The top level (e.g. "Home") is on the top of the menu. I want the menu to stay complete, whereever I am. You don't remove items from any other menu, when you are on the page to which that item links, do you ...The side menu disappears completely when there are no sub-pages. Somehow I found it simpler to use ParentPage than sm2 directly, don't remember exactly why.
$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);// show up levelif ($nLevel > 0) {$lev = $nLevel - 1;return show_menu2(0, SM2_ROOT, SM2_CURR, SM2_CRUMB|SM2_BUFFER, "[if(level==$lev){[a][menu_title]</a>}]", '', '', '');}else {return show_menu2(0, SM2_ROOT, SM2_CURR, SM2_CRUMB|SM2_BUFFER, "[if(level==0){[a][menu_title]</a>}]", '', '', '');}
<div id="sidemenu"> <?php $mb2 = show_menu2(0,SM2_ROOT+1,SM2_ALL,SM2_TRIM|SM2_BUFFER); if ($mb2!='') echo '<div id="parent">[[ParentPage]]</div>'.$mb2; ?> </div>
<?php if ($mb2!='') echo '<div id="parent">[[ParentPage]]</div>'.$mb2; else echo '<div id="parent">Search</div>'; (or some code to get the current top level item)?>