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,&#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
        }
        ?>
--- 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