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.6 is now available!


Will it continue with WB? It goes on! | Geht es mit WB weiter? Es geht weiter!
https://forum.websitebaker.org/index.php/topic,32340.msg226702.html#msg226702


The forum email address board@websitebaker.org is working again
https://forum.websitebaker.org/index.php/topic,32358.0.html


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 »
  • how to retrieve menu id related to page
  • Print
Pages: [1]   Go Down

Author Topic: how to retrieve menu id related to page  (Read 7529 times)

acavacini

  • Guest
how to retrieve menu id related to page
« on: April 25, 2008, 04:23:41 PM »
hi,
if you need to retrive the menu id releated to your page

add this code to frontend.function.php file
 
Code: [Select]
if (!function_exists('get_menu_id')) {
            function get_menu_id() {
               global $wb, $database;
               $page_id = $wb->page_id;
           $get_menu_id = $database->get_one("SELECT menu FROM ".TABLE_PREFIX."pages WHERE page_id = ". $page_id ." Limit 1;");
               return $get_menu_id;
        }
}

and now call get_menu_id() from your page.

useful with show_menu2

seeU  :-P
« Last Edit: April 25, 2008, 04:36:08 PM by scrabble »
Logged

Offline ruebenwurzel

  • Betatester
  • **
  • Posts: 8544
  • Gender: Male
  • Keep on Rockin
    • Familie Gallas Online
Re: how to retrieve menu id related to page
« Reply #1 on: April 25, 2008, 05:34:33 PM »
Hello,

there is no need for changing core files to get the menu_id or page_id for show_menu2, as this is already included in the show_menu2 files. Please read the docu wich comes with the modul.

Matthias
Logged

acavacini

  • Guest
Re: how to retrieve menu id related to page
« Reply #2 on: April 25, 2008, 07:02:51 PM »
hi,

after many attempts i solved using

Code: [Select]
show_menu2(-1,...);
the documentation was unhelpful in this case  :-(

anyway thanks for the suggestion  :wink:
Logged

brofield

  • Guest
Re: how to retrieve menu id related to page
« Reply #3 on: April 26, 2008, 08:51:42 AM »
Don't pass in particular numbers if there is a define for it. You are actually calling
show_menu2(SM2_ALLMENU, ...);
That will display every menu that is defined. Not what it sounds like you wanted.

It sounds like you want this.
show_menu2(0, ...);
Which will display the default menu (i.e. current menu) for the current page.

current page id is PAGE_ID
menu id for the current page is found like:
$aMenu = $wb->page['menu'] == '' ? 1 : $wb->page['menu'];

B
Logged

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Droplets & Snippets »
  • how to retrieve menu id related to page
 

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