WebsiteBaker Support (2.8.x) > Templates, Menus & Design

show_menu2 help - active page with div ID

(1/2) > >>

kevyn:
Wondering if anyone can help me please...

here is the original structure of my html menu:


--- Code: ---<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>
--- End code ---

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: ---<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>
--- End code ---

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

Stefek:
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

kevyn:
thank you so much  8-)

I did try the documentation, but couldn't figure out where I was going wrong!

Stefek:
You're welcome.

enjoy WB  :wink:

Stefek

kevyn:
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

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: ---<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>
--- End code ---

right side menu:


--- Code: --- <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>

--- End code ---

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 :-)

Navigation

[0] Message Index

[#] Next page

Go to full version