WebsiteBaker Community Forum

WebsiteBaker Support (2.8.x) => Templates, Menus & Design => Topic started by: kevyn on September 16, 2010, 12:59:10 AM

Title: show_menu2 help - active page with div ID
Post by: kevyn on September 16, 2010, 12:59:10 AM
Wondering if anyone can help me please...

here is the original structure of my html menu:

Code: [Select]
<div class="navigation">
    
    <a href="index.html" id="active">Item1</a>
    <a href="index.html">item2</a>
    <a href="index.html">item3</a>
    <a href="index.html">item4</a>


    <div class="clearer"></div>

</div>

and I would love to have the active page highlighted, but can't figure out how to get it to work :-(

Here is my current code:

Code: [Select]
<div class="navigation">
 <?php 
                show_menu2

        
$aMenu          0,
        
$aStart         SM2_ROOT,
        
$aMaxLevel      SM2_CURR+1,
        
$aOptions       SM2_TRIM,
        
$aItemOpen      = &#39;<a href="[url]" > [menu_title]&#39;,
        
$aItemClose     = &#39;</a>&#39;,
        
$aMenuOpen      = &#39; &#39;,
        
$aMenuClose     = &#39; &#39;,
        
$aTopItemOpen   false,
        
$aTopMenuOpen   false
                 
);
                  
?>


    
    <div class="clearer"></div>

</div>

please can anyone help? Many thanks in advance! :-)

ps. I plan to have a 2nd menu added to my page at a later date - so any warnings how this could affect my current menu would be appreciated
Title: Re: show_menu2 help - active page with div ID
Post by: Stefek on September 16, 2010, 01:14:26 AM
Hello,

just try this replacement in your sm2 call:

$aItemOpen  = '<a href="[url]"[if(class==menu-current) { id="active"}]> [menu_title]',

(insertion = red)

Hope this helps.

By the way, more about this topic can be found here:
http://code.google.com/p/showmenu2/source/browse/trunk/README.en.txt?r=31#455

Regards,
Stefek
Title: Re: show_menu2 help - active page with div ID
Post by: kevyn on September 16, 2010, 01:35:14 AM
thank you so much  8-)

I did try the documentation, but couldn't figure out where I was going wrong!
Title: Re: show_menu2 help - active page with div ID
Post by: Stefek on September 16, 2010, 05:05:39 AM
You're welcome.

enjoy WB  :wink:

Stefek
Title: Re: show_menu2 help - active page with div ID
Post by: kevyn on September 16, 2010, 03:38:57 PM
thanks for the help, but now I'd like a little more advice please...

I'm setting up my 2nd menu on the page, which I just want to display level2 menus - and I want my main 'top navigation' to just display level1 (parent) menus.

my page is located here: http://www.leamtechwebsitedesign.com/pages/menu.php (http://www.leamtechwebsitedesign.com/pages/menu.php)

As you can see, I'm trying to design a site for a restaurant - I want to click 'menu' and have the list on the right displayed, which works ok, however whenever I click on any of the child items in the menu, they all display on the top navigation.

here is my code again:

top main navigation
Code: [Select]
<div class="navigation">
 <?php 
show_menu2
        
$aMenu          0,
        
$aStart         SM2_ROOT,
        
$aMaxLevel      SM2_CURR,
        
$aOptions       SM2_TRIM,
        
$aItemOpen      = &#39;<a href="[url]"[if(class==menu-current) { id="active"}] > [menu_title]&#39;,
        
$aItemClose     = &#39;</a>&#39;,
        
$aMenuOpen      = &#39; &#39;,
        
$aMenuClose     = &#39; &#39;,
        
$aTopItemOpen   false,
        
$aTopMenuOpen   false
 );
      
?>




<div class="clearer"></div>

</div>

right side menu:

Code: [Select]
<ul id="pages">
<?php 
show_menu2
$aMenu          0,
$aStart         SM2_ROOT+1,
$aMaxLevel      SM2_CURR+1,
$aOptions       SM2_TRIM,
$aItemOpen      = &#39;<li><a href="[url]" > [menu_title]&#39;,
$aItemClose     = &#39;</a></li>&#39;,
$aMenuOpen      = &#39;&#39;,
$aMenuClose     = &#39;&#39;,
$aTopItemOpen   false,
$aTopMenuOpen   false
 );
?>

</ul>

<?php page_content(2); ?>

</div>

can anyone see where I'm going wrong? - again I'm a bit of a noob to wb and show_menu2 and I've tried to get my head around the documentation for showmenu2 but it leaves me a little confused after a lot of trial and error!

I hope this makes sense, and thanks :-)
Title: Re: show_menu2 help - active page with div ID
Post by: Stefek on September 16, 2010, 03:52:13 PM
Hello,

This time I will only give you advice where to search ;-)
http://code.google.com/p/showmenu2/source/browse/trunk/README.en.txt?r=31#267

Regards,
Stefek
Title: Re: show_menu2 help - active page with div ID
Post by: kevyn on September 16, 2010, 04:29:33 PM
Ok well it appears that using SM2_CURR  (Current no children) isn't actually enough, and you have do add SM2_START to the maxlevel tag

It's a little confusing because it sounds like these both do the same thing, but after some more trial and error it turns out it works if you insert them both for some reason
Title: Re: show_menu2 help - active page with div ID
Post by: Stefek on September 16, 2010, 04:39:44 PM
Hello,

START doesn't mean ROOT or LEVEL 0, therefore it is correct  :wink:

Regards,
Stefek