WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.9 R24 is now available!


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Droplets & Snippets »
  • [[parentpage]]
  • Print
Pages: [1]   Go Down

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

Offline bupaje

  • Posts: 592
[[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.
Logged

Offline bupaje

  • Posts: 592
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.

Logged

Offline Ruud

  • Posts: 3671
  • 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(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;

« Last Edit: July 16, 2013, 10:17:52 AM by Ruud »
Logged
Dev4me - WebsiteBaker modules - WBhelp.org

Offline bupaje

  • Posts: 592
Re: [[parentpage]]
« Reply #3 on: July 16, 2013, 06:07:21 PM »
Thanks Ruud. That works.  :)
Logged

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Droplets & Snippets »
  • [[parentpage]]
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2