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">
                                
               <
li id="active"><a href="http://www.pingpong-witterzee.be/">Homea>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">Calendriera>li>
               <
li><a href="http://www.pingpong-witterzee.be/modules/smartsection/">Articlesa>li>
               <
li><a href="http://www.bbw291.be/forum/index.php" target="_blank">Foruma>li>
               <
li><a href="http://www.pingpong-witterzee.be/modules/smartfaq">FAQa>li>
               <
li><a href="http://www.bbw291.be/photos/" target="_blank">Photosa>li>
               <
li><a href="http://www.pingpong-witterzee.be/modules/wflinks/index.php">Liensa>li>
               <
li><a href="http://www.pingpong-witterzee.be/modules/sitemap">Plan du sitea>li>
               <
li><a href="http://www.bbw291.be/Download.htm">Downloada>li>
               <
li><a href="http://www.pingpong-witterzee.be/modules/contact">Infosa>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


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

351 user(s) are online (266 user(s) are browsing Support Forums)


Members: 1


Guests: 350


Harald0123,

more...

Donat-O-Meter

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

Latest GitHub Commits