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


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) »
  • Templates, Menus & Design »
  • SOLVED! show menu only when content available
  • Print
Pages: [1]   Go Down

Author Topic: SOLVED! show menu only when content available  (Read 4818 times)

spida

  • Guest
SOLVED! show menu only when content available
« 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
« Last Edit: April 23, 2008, 12:31:13 PM by spida »
Logged

spida

  • Guest
Re: show menu only when content available
« Reply #1 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:
Logged

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Templates, Menus & Design »
  • SOLVED! show menu only when content available
 

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