Welcome, Guest. Please login or register.
Did you miss your activation email?
May 26, 2012, 03:14:41 PM

Login with username, password and session length
Search:     Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter hier und auf unserer neuen Webseite.
155540 Posts in 21712 Topics by 7736 Members
Latest Member: chris85
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: show_menu2 help - active page with div ID  (Read 712 times)
kevyn

Offline Offline

Posts: 10


« on: September 15, 2010, 11:59:10 PM »

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>

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

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      '<a href="[url]" > [menu_title]',
        
$aItemClose     '</a>',
        
$aMenuOpen      ' ',
        
$aMenuClose     ' ',
        
$aTopItemOpen   false,
        
$aTopMenuOpen   false
                 
);
                  
?>


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

</div>

please can anyone help? Many thanks in advance! smiley

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
« Last Edit: September 16, 2010, 12:01:04 AM by kevyn » Logged
Stefek
WebsiteBaker Org e.V.

Offline Offline

Posts: 4884



« Reply #1 on: September 16, 2010, 12: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
Logged

"In a time of universal deceit, telling the truth becomes a revolutionary act."
- George Orwell, Nineteen eighty-four (1984)
kevyn

Offline Offline

Posts: 10


« Reply #2 on: September 16, 2010, 12:35:14 AM »

thank you so much  cool

I did try the documentation, but couldn't figure out where I was going wrong!
Logged
Stefek
WebsiteBaker Org e.V.

Offline Offline

Posts: 4884



« Reply #3 on: September 16, 2010, 04:05:39 AM »

You're welcome.

enjoy WB  wink

Stefek
Logged

"In a time of universal deceit, telling the truth becomes a revolutionary act."
- George Orwell, Nineteen eighty-four (1984)
kevyn

Offline Offline

Posts: 10


« Reply #4 on: September 16, 2010, 02: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

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      '<a href="[url]"[if(class==menu-current) { id="active"}] > [menu_title]',
        
$aItemClose     '</a>',
        
$aMenuOpen      ' ',
        
$aMenuClose     ' ',
        
$aTopItemOpen   false,
        
$aTopMenuOpen   false
 );
      
?>




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

</div>

right side menu:

Code:
<ul id="pages">
<?php 
show_menu2
$aMenu          0,
$aStart         SM2_ROOT+1,
$aMaxLevel      SM2_CURR+1,
$aOptions       SM2_TRIM,
$aItemOpen      '<li><a href="[url]" > [menu_title]',
$aItemClose     '</a></li>',
$aMenuOpen      '',
$aMenuClose     '',
$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 smiley
Logged
Stefek
WebsiteBaker Org e.V.

Offline Offline

Posts: 4884



« Reply #5 on: September 16, 2010, 02:52:13 PM »

Hello,

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

Regards,
Stefek
Logged

"In a time of universal deceit, telling the truth becomes a revolutionary act."
- George Orwell, Nineteen eighty-four (1984)
kevyn

Offline Offline

Posts: 10


« Reply #6 on: September 16, 2010, 03: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
Logged
Stefek
WebsiteBaker Org e.V.

Offline Offline

Posts: 4884



« Reply #7 on: September 16, 2010, 03:39:44 PM »

Hello,

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

Regards,
Stefek
Logged

"In a time of universal deceit, telling the truth becomes a revolutionary act."
- George Orwell, Nineteen eighty-four (1984)
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!