WebsiteBaker Support (2.8.x) > Templates, Menus & Design
show_menu2 - Display only one level of children of a selected page?
melissa:
I am working on a site and trying to use a background image for the top level of links, and then CSS drop down menu for two pages.
http://test.wendywilliams.com.au
The two pages with drop down are "What's Your Problem" and "Free Stuff". The What's Your Problem page has 2 sublevels, but I only want to display one. I have tried a lot of different options with show_menu2, but am really struggling to see that it is possible!
Everything I have tried apart from SM2_ALL on the fourth variable displays no menu at all, and SM2_ALL displays the level I wish to hide.
--- Code: ---<ul id="menuInner">
<li id="whats-your-problem"><a href="/pages/whats-your-problem.php" title="What's Your Problem?"><b>What's Your Problem?</b><!--[if gte IE 7]><!--></a><!--<![endif]-->
<!--[if lte IE 6]><table><tr><td><![endif]-->
[b]<?php show_menu2(0, 2, SM2_ROOT, SM2_ROOT); ?>[/b]
<!--[if lte IE 6]></td></tr></table></a><![endif]-->
</li>
<li id="in-clinic-testing"><a href="/pages/in-clinic-testing.php" title="In Clinic Testing"><b>In Clinic Testing</b></a></li>
<li id="free-stuff"><a href="/pages/free-stuff.php" title="Free Stuff"><b>Free Stuff</b><!--[if gte IE 7]><!--></a><!--<![endif]-->
<!--[if lte IE 6]><table><tr><td><![endif]-->
[b]<?php show_menu2(0, 4, SM2_ROOT, SM2_ALL); ?>[/b]
<!--[if lte IE 6]></td></tr></table></a><![endif]-->
</li>
<li id="about-wendy"><a href="/pages/about-wendy.php" title="About Wendy"><b>About Wendy</b></a></li>
<li id="contact"><a href="/pages/contact-wendy.php" title="Contact"><b>Contact</b></a></li>
</ul>
--- End code ---
I have also tried:
--- Code: ---<?php show_menu2(0, 2, SM2_ROOT, SM2_MAX+1); ?>
--- End code ---
--- Code: ---<?php show_menu2(0, 2, SM2_ROOT, SM2_MAX); ?>
--- End code ---
--- Code: ---<?php show_menu2(0, 2, SM2_ROOT, SM2_START+1); ?>
--- End code ---
--- Code: ---<?php show_menu2(0, 2, SM2_ROOT, SM2_START); ?>
--- End code ---
All of those displayed no drop down at all.
melissa:
I have figured out a way to hide the sub level using CSS, but I'd rather like to know why show_menu2 didn't work the way I expected with SM2_START and SM2_MAX, if anyone is listening!
Argos:
When I look at your site, I don't see dropdowns on "What's your problem"at all... Did you change it?
melissa:
Hi Argos,
Thanks for replying. I've been having a go with different variables to try and get a result, as listed in my post, that's why there's nothing dropping down there. You can see:
--- Code: ---<?php show_menu2(0, 4, SM2_ROOT, SM2_ALL);
--- End code ---
Under "In Clinic Testing". Under "What's Your Problem" is one of the four other options.
Is there something I'm not understanding about the logic of show_menu2? It seems to me that it is dependent on the page you are currently viewing. You can't tell it to display a menu for another page. Maybe I need to hardcode the whole thing.
Melissa
Argos:
No, you shouldn't be using different menus for each section, and you shouldn't hard code. If I understand you well, you have a menu like:
Parent 1
Parent 2
- Child 1
- Child 2
- - Child of Child 1
- - Child of Child 2
Parent 3
But you want to show only:
Parent 1
Parent 2
- Child 1
- Child 2
Parent 3
Right?
Then I think the default basic menu call should do the trick functionally:
--- Code: ---show_menu2();
--- End code ---
Navigation
[0] Message Index
[#] Next page
Go to full version