Author Topic: [[parentpage]]  (Read 2210 times)

Offline bupaje

  • Posts: 570
    • http://www.stormvisions.com
[[parentpage]]
« on: July 16, 2013, 01:03:39 AM »
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.

Code: [Select]
$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.
My Blog, My Site

Offline bupaje

  • Posts: 570
    • http://www.stormvisions.com
Re: [[parentpage]]
« Reply #1 on: July 16, 2013, 02:26:53 AM »
Just a bit more info it generates multiple instances of the div

Code: [Select]
$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 '';

Code: [Select]
<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.

My Blog, My Site

Offline Ruud

  • Posts: 3653
  • Gender: Male
  • Do not use PM for help! Please use the forum!
    • Dev4Me - Professional WebsiteBaker Development
Re: [[parentpage]]
« Reply #2 on: July 16, 2013, 10:15:01 AM »
Try this:
Code: (untested) [Select]
<?php
$info 
show_menu2(0SM2_CURRSM2_STARTSM2_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(0SM2_ROOTSM2_CURRSM2_CRUMB|SM2_BUFFER"[if(level==$lev){[a][menu_title]</a>}]"'''''');
        if(
$parent
return '<div class="kb_submenu">'.$parent.'</div>';
}
return 
true;

« Last Edit: July 16, 2013, 10:17:52 AM by Ruud »

Offline bupaje

  • Posts: 570
    • http://www.stormvisions.com
Re: [[parentpage]]
« Reply #3 on: July 16, 2013, 06:07:21 PM »
Thanks Ruud. That works.  :)
My Blog, My Site