WebsiteBaker Community Forum

WebsiteBaker Support (2.8.x) => Templates, Menus & Design => Topic started by: spida on April 23, 2008, 12:22:14 PM

Title: SOLVED! show menu only when content available
Post by: spida on April 23, 2008, 12:22:14 PM
Hello to everyone!

I am using the following show_menu code in a template:
Code: [Select]
       <?php ob_start();     // start output buffer
        
show_menu(1,2,1,true,&#39;<li>[a][menu_title][/a]</li>&#39;,&#39;&#39;,&#39;&#39;,&#39;&#39;,&#39;&#39;,&#39;&#39;);    // 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 &#39;<div id="menu-page">&#39;;
          
echo &#39;<h3>Menu</h3>&#39;; 
          
echo &#39;<ul>&#39;;
          
echo $foo
          echo &
#39;</ul>&#39;;                              // show the block (as saved in $foo)
          
echo &#39;</div>&#39;;
            
} else { // some code for no info
        
}
        
?>

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: [Select]
// some code for no info with
Code: [Select]
echo '<div id="empty"></div>';, but this didn't work.

Your help is, as always, very welcome.  :-)

Regards,
Ayshe
Title: Re: show menu only when content available
Post by: spida on April 23, 2008, 12:30:44 PM
OK, I just found out that I have to apply the background-image in the CSS differently. Problem solved!  :mrgreen: