WebsiteBaker Support (2.8.x) > Templates, Menus & Design
SOLVED! show menu only when content available
(1/1)
spida:
Hello to everyone!
I am using the following show_menu code in a template:
--- Code: --- <?php ob_start(); // start output buffer
show_menu(1,2,1,true,'<li>[a][menu_title][/a]</li>','','','','',''); // call menu
$foo=ob_get_contents(); // put outputbuffer in $foo
ob_end_clean(); // clear outputbuffer
if ($foo<>"") { // some code to execute cause there is some block
echo '<div id="menu-page">';
echo '<h3>Menu</h3>';
echo '<ul>';
echo $foo;
echo '</ul>'; // show the block (as saved in $foo)
echo '</div>';
} else { // some code for no info
}
?>
--- End code ---
In the accomplishing CSS a background-image is defined for the div containing this menu.
What I need now, is a possibility to have the whole div only shown when there ARE entries for the submenu. I tried it with the else-part, exchanging
--- Code: --- // some code for no info
--- End code ---
with
--- Code: ---echo '<div id="empty"></div>';
--- End code ---
, but this didn't work.
Your help is, as always, very welcome. :-)
Regards,
Ayshe
spida:
OK, I just found out that I have to apply the background-image in the CSS differently. Problem solved! :mrgreen:
Navigation
[0] Message Index
Go to full version