1
capouille
change active link in menu according to module used
  • 2005/12/22 17:49

  • capouille

  • Just popping in

  • Posts: 6

  • Since: 2005/12/22


Hello,
Firs of all, because I dont speak a good english (yes, I'm from Belgium), it could be a lot of bad sentences in the text...

Well, I've asked some people on frxoops.org how to change the active link on a menu designed directly on a theme. But nobody can help me.

For example, take a look on my site (http://www.pingpong-witterzee.be). On the menu, the option "home"is tha active link by default. The code inserted in the file "theme.html" is like this one

<div id="navcontainer">
                        <
ul id="navlist">
                                <!-- 
CSS Tabs -->
               <
li id="active"><a href="http://www.pingpong-witterzee.be/">Home</a></li>
               <
li><a href="http://www.pingpong-witterzee.be/modules/myHome/">A propos...</a></li>
               <
li><a href="http://www.pingpong-witterzee.be/modules/extcal/calendar.php">Calendrier</a></li>
               <
li><a href="http://www.pingpong-witterzee.be/modules/smartsection/">Articles</a></li>
               <
li><a href="http://www.bbw291.be/forum/index.php" target="_blank">Forum</a></li>
               <
li><a href="http://www.pingpong-witterzee.be/modules/smartfaq">FAQ</a></li>
               <
li><a href="http://www.bbw291.be/photos/" target="_blank">Photos</a></li>
               <
li><a href="http://www.pingpong-witterzee.be/modules/wflinks/index.php">Liens</a></li>
               <
li><a href="http://www.pingpong-witterzee.be/modules/sitemap">Plan du site</a></li>
               <
li><a href="http://www.bbw291.be/Download.htm">Download</a></li>
               <
li><a href="http://www.pingpong-witterzee.be/modules/contact">Infos</a></li>
                        </
ul>
            </
div>



What I want : wich code (php ?) use to change the active link according to the module used ?
if the active module is "smartsection" then the active link must be "Articles"; if this is the "smartfaq", "FAQ" and the same for every link (appart the two one wich point to bbw291.be)

Thanks

2
Catzwolf
Re: change active link in menu according to module used
  • 2005/12/22 18:22

  • Catzwolf

  • Home away from home

  • Posts: 1392

  • Since: 2007/9/30


you will find the code in /kernel/module.php

3
capouille
Re: change active link in menu according to module used
  • 2005/12/23 15:54

  • capouille

  • Just popping in

  • Posts: 6

  • Since: 2005/12/22


Quote:

John_N wrote:
you will find the code in /kernel/module.php


Wow, I've took a look on it but I don't understand everything (i'm new with php but not with html)
Can you give me an example for one of my link ?
I will try to do the same as your example for the others...

Thanks

4
capouille
Re: change active link in menu according to module used
  • 2005/12/28 15:37

  • capouille

  • Just popping in

  • Posts: 6

  • Since: 2005/12/22


is there someone who can help me ?
I don't know how to use the code of module.php with my theme.html

5
jlm69
Re: change active link in menu according to module used
  • 2005/12/28 17:12

  • jlm69

  • Module Developer

  • Posts: 719

  • Since: 2002/7/19


I am not sure if this will help you, I didn't see a mainmenu on your site just the horizontal menu at the top.
To do this with the main menu that is a side box you can just add these two lines to the mainmenu part of your css.(change the colors to your preference.


td#mainmenu2 a:active {background-color: #FFFFFF;}
td#mainmenu2 a.menuMainActive {background-color: #FFFFFF; border-top: 1px solid #666666; border-right: 1px solid #666666; border-bottom: 1px solid #666666; border-left: 1px solid #666666;}


Like I said this is for the traditional mainmenu, but maybe it will help.

John

6
capouille
Re: change active link in menu according to module used
  • 2005/12/28 17:24

  • capouille

  • Just popping in

  • Posts: 6

  • Since: 2005/12/22


Quote:

jlm69 wrote:
I am not sure if this will help you, I didn't see a mainmenu on your site just the horizontal menu at the top.
To do this with the main menu that is a side box you can just add these two lines to the mainmenu part of your css.(change the colors to your preference.


td#mainmenu2 a:active {background-color: #FFFFFF;}
td#mainmenu2 a.menuMainActive {background-color: #FFFFFF; border-top: 1px solid #666666; border-right: 1px solid #666666; border-bottom: 1px solid #666666; border-left: 1px solid #666666;}


Like I said this is for the traditional mainmenu, but maybe it will help.

John


Thanks for your advice, jlm69, but in fact it's code of the horizontal menu at the top that I give in my firt post.
The
<li id="active">
must change when I browse through the site...
someone on frxoops had a solution but had never released it...

7
capouille
Re: change active link in menu according to module used
  • 2006/1/4 5:32

  • capouille

  • Just popping in

  • Posts: 6

  • Since: 2005/12/22


I have a solution for my problem :
1) add this on the header of the theme.htm
<{php}>
$mod $GLOBALS['xoopsModule'];
$dirname = (isset($mod) ? $mod->getVar('dirname') :'system');
$GLOBALS['xoopsTpl']->assign'xoops_cmod'$dirname );
<{/
php}>


2) add something like this on te body tag
<body class="menu-<{if $xoops_cmod == news}>news<{elseif $xoops_cmod == articles}>articles<{elseif $xoops_cmod == links}>links<{elseif $xoops_cmod == photos}>photos<{elseif $xoops_cmod == videos}>videos<{elseif $xoops_cmod == streaming}>videos<{elseif $xoops_cmod == newbb}>forum<{elseif $xoops_cmod == blogs}>blogs<{elseif $xoops_cmod == faq}>faq<{else}>home<{/if}>">

(in fact, all the modules installed on xoops)

3) for each line of the menu
<li id="nav-1-system">
<
li id="nav-2-myhome">
<
li id="nav-3-...">
(add a line for each module)

4) add in the .css all the combinated values with the required format (something like this
<!--

/* MENU */
#blocmenu {
        
background#369;
        
border-top1px solid #9CC;
        
fontnormal normal 11px VerdanaGenevaArialHelveticasans-serif;
}

#menu {
        
list-stylenone outside none;
        
margin0;
        
padding0;
}

@
media all {
        
#menu {
                
text-aligncenter
        
}
}

#menu ul, #menu li {
        
bottom11px;
        
displayinline;
        
line-height1.2em;
        
margin0;
        
padding0;
        
positionrelative;
}

#menu a:link, #menu a:visited {
        
background#900;
        
border1px solid #FFF;
        
bottom2px;
        
color#FFF;
        
cursorpointer;
        
displayinline;
        
height1.2em;
        
margin0;
        
padding3px 5px 3px 5px;
        
positionrelative;
        
right2px;
        
text-decorationnone;
}

#menu a:hover {
        
background#C00;
        
bottom1px;
        
color#FFF;
        
positionrelative;
        
right1px;
}

#menu a:active {
        
background#369;
        
bottom0px;
        
color#FFF;
        
positionrelative;
        
right0px;
}

#menu li#active {
        
background#369;
        
bottom11px;
        
displayinline;
        
margin0 3px 0 0;
        
padding0;
        
positionrelative;
}
body.menu-system #menu li#nav-1-system a, 
body.menu-myHome #menu li#nav-2-myHome a,
body.menu-extcal #menu li#nav-3-extcal a,
body.menu-smartsection #menu li#nav-4-smartsection a, 
body.menu-smartfaq #menu li#nav-5-smartfaq a,
body.menu-wflinks #menu li#nav-6-wflinks a,
body.menu-sitemap #menu li#nav-7-sitemap a, 
body.menu-contact #menu li#nav-8-contact a {
        
background#369;
        
border-bottomnone;
        
border-left1px solid #9CC;
        
border-right1px solid #9CC;
        
border-top1px solid #9CC;
        
bottom0;
        
color#FFF;
        
cursortext;
        
margin0;
        
padding2px 5px 0 5px;
        
positionrelative;
        
right0;
}
                -->


You can see the result here

Many, many thanks to SpeedAirMan on frxoops for this info !!

Bye everyone

8
incama
Re: change active link in menu according to module used
  • 2006/1/8 9:09

  • incama

  • Friend of XOOPS

  • Posts: 513

  • Since: 2003/10/24


I often have used this hack on many XOOPS sites,.but now I'm running into trouble. I'm building a XOOPS 2.2.3 site and the hack doesn't work. Anyone any idea?
Webdesign
Sitting Ducks?!
I hate politics, give me a stylie instead...

9
incama
Re: change active link in menu according to module used
  • 2006/1/8 9:15

  • incama

  • Friend of XOOPS

  • Posts: 513

  • Since: 2003/10/24


Quote:

incama wrote:
I often have used this hack on many XOOPS sites,.but now I'm running into trouble. I'm building a XOOPS 2.2.3 site and the hack doesn't work. Anyone any idea?


Oops,.YASQTAHBAITFS (yet another stupid question that already has been answered in the faq section)

link here!
Webdesign
Sitting Ducks?!
I hate politics, give me a stylie instead...

Login

Who's Online

73 user(s) are online (41 user(s) are browsing Support Forums)


Members: 0


Guests: 73


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Aug 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits