WebsiteBaker Support (2.8.x) > Templates, Menus & Design
Check a page is in a certain menu (menu in array?)
(1/1)
Indextra:
Hello,
I have 2 menu's on my site. Is there a possibilty to check that a certain page is in a certain menu? This could very easily be done if the menu could be loaded in an array. However this is not possible, as far as I know.
Has someone an idea?
Greets,
Remi
Stefek:
Hello,
I don't know what the exact purpose of this is..
but you could create your own function selecting the pages directly from the database.
Just look at the table TABLE_PREFIX.'pages in the database.
Regards,
Stefek
Indextra:
Thank you!
If someone is wondering I used the following code:
--- Code: ---<?php
$menunum = false;
$rslt = mysql_query('SELECT menu FROM '.TABLE_PREFIX.'pages WHERE page_id = \''.PAGE_ID.'\'');
if(mysql_num_rows($rslt)>0){
while($row = mysql_fetch_array($rslt)){
$menunum = $row['menu'] ;
}
}
?>
--- End code ---
Stefek:
Cool,
you could use WBs own Class database "get_one" Methode to short your code:
--- Code: ---
$menunum= $database->get_one('SELECT menu FROM '.TABLE_PREFIX.'pages WHERE page_id = \''.PAGE_ID.'\'');
--- End code ---
Regards,
Stefek
Navigation
[0] Message Index
Go to full version