Welcome, Guest. Please login or register.
Did you miss your activation email?
May 27, 2012, 03:02:38 AM

Login with username, password and session length
Search:     Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter hier und auf unserer neuen Webseite.
155555 Posts in 21715 Topics by 7737 Members
Latest Member: gx-world
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: how to retrieve menu id related to page  (Read 1337 times)
scrabble

Offline Offline

Posts: 2


« on: April 25, 2008, 03:23:41 PM »

hi,
if you need to retrive the menu id releated to your page

add this code to frontend.function.p hp file
 
Code:
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  tongue
« Last Edit: April 25, 2008, 03:36:08 PM by scrabble » Logged
ruebenwurzel
WebsiteBaker Org e.V.

Offline Offline

Posts: 7973



WWW
« Reply #1 on: April 25, 2008, 04: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
scrabble

Offline Offline

Posts: 2


« Reply #2 on: April 25, 2008, 06:02:51 PM »

hi,

after many attempts i solved using

Code:
show_menu2(-1,...);

the documentation was unhelpful in this case  sad

anyway thanks for the suggestion  wink
Logged
brofield

Offline Offline

Posts: 224


WWW
« Reply #3 on: April 26, 2008, 07: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
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!