1
davidthomas1
custom sublinks in the mainmenu

I know how to add custom links to the main menu by editing the template.

However, if I add custom sublinks to the main menu, they are always expanded.

Is is possible to add custom dynamic sublinks to the main menu that expand when the main-link is clicked? or are custom sub-links always permanently displayed?

2
hervet
Re: custom sublinks in the mainmenu
  • 2005/6/12 12:16

  • hervet

  • Friend of XOOPS

  • Posts: 2267

  • Since: 2003/11/4


Hello,

I beleive there is a FAQ for this subject.
But you can also use another method, have a look to the multimenu module. You will find it in the repository.

Bye,
Hervé

3
davidthomas1
Re: custom sublinks in the mainmenu

Thanks for the reply.

I had tried multiMenu but it was too tied up with the module URL's for my needs.

I wanted a menu that takes arbitrary main links and sublinks with no connection to XOOPs modules.

I ended up making a custom block menu with drop-down submenus etc.. it works fine.

Here's the code if anyone else is doing a similar thing :

I put the sub-links in DIV blocks and called a javascript function on main-link click to toggle the DIV blocks CSS display property.

It's quite simple, and it works

<script type="text/javascript">
function 
showMenu(list)
{
  var 
listElementStyle=document.getElementById(list).style;
  if (
listElementStyle.display=="none")
  {
listElementStyle.display="";}
  else 
  {
listElementStyle.display="none";}
}
</
script>

<
tbody>
<
tr>
<
td id="mainmenu">
       
<
class="menuTop" href="{X_SITEURL}index.php"Home </a>
<
class="menuMain" href="{X_SITEURL}modules/articles/article.php?id=17"Contact AJET </a>
<
class="menuMain" href="javascript:showMenu('ajetgroups');">AJET Groups </a>
<
div id="ajetgroups" style="display:none;">
<
class="menuSub" href="{X_SITEURL}modules/weblinks/viewcat.php?cid=1"Prefectural AJET Groups </a>
<
class="menuSub" href="{X_SITEURL}modules/weblinks/viewcat.php?cid=2"Special Interest Groups </a>
<
class="menuSub" href="{X_SITEURL}modules/weblinks/viewcat.php?cid=3"Nationality Groups </a>
<
class="menuSub" href="{X_SITEURL}modules/weblinks/viewcat.php?cid=26"Language Groups </a>
</
div>
<
class="menuMain" href="javascript:showMenu('publications');"Publications </a>
<
div id="publications" style="display: none;">
<
class="menuSub" href="http://aaj.ajet.net/"AJET Across Japan Magazine </a>
<
class="menuSub" href="http://ttp.ajet.net/"Team Taught Pizza </a>
<
class="menuSub" href="{X_SITEURL}modules/articles/article.php?id=18#hajet"Hokkaido AJET Publications </a>
<
class="menuSub" href="{X_SITEURL}modules/articles/article.php?id=18#hajet"Fukushima AJET Publications </a>
<
class="menuSub" href="{X_SITEURL}modules/articles/index.php?cat_id=8"E-Bulletins </a>
</
div>
<
class="menuMain" href="javascript:showMenu('services');"Services </a>
<
div id="services" style="display: none;">
<
class="menuSub" href="{X_SITEURL}modules/articles/article.php?id=19"AJET Peer Support Group </a>
<
class="menuSub" href="{X_SITEURL}modules/articles/article.php?id=21"Teaching Awards </a>
</
div>
<
class="menuMain" href="javascript:showMenu('faq');"FAQs </a>
<
div id="faq" style="display: none;">
<
class="menuSub" href="{X_SITEURL}modules/articles/article.php?id=3"English</a>
<
class="menuSub" href="{X_SITEURL}modules/articles/article.php?id=37">  &#12424;&#12367;&#12354;&#12427;&#12372;&#36074;&#21839; &#65288;&#26085;&#26412;&#35486;&#65289;</a>
</div>
<
class="menuMain" href="{X_SITEURL}modules/wfdownloads/"Downloads </a>
<
class="menuMain" href="{X_SITEURL}modules/weblinks/"Web Links</a>
</
td>
</
tr>
</
tbody>


There you have it a nice custom menu with expandable sub-links

hope it helps someone

ciao,

D.

4
deren
Re: custom sublinks in the mainmenu
  • 2006/11/18 4:40

  • deren

  • Just popping in

  • Posts: 10

  • Since: 2006/11/2


your code is Not working
Quote:

davidthomas1 wrote:
Thanks for the reply.

I had tried multiMenu but it was too tied up with the module URL's for my needs.

I wanted a menu that takes arbitrary main links and sublinks with no connection to XOOPs modules.

I ended up making a custom block menu with drop-down submenus etc.. it works fine.

Here's the code if anyone else is doing a similar thing :

I put the sub-links in DIV blocks and called a javascript function on main-link click to toggle the DIV blocks CSS display property.

It's quite simple, and it works

<script type="text/javascript">
function 
showMenu(list)
{
  var 
listElementStyle=document.getElementById(list).style;
  if (
listElementStyle.display=="none")
  {
listElementStyle.display="";}
  else 
  {
listElementStyle.display="none";}
}
</
script>

<
tbody>
<
tr>
<
td id="mainmenu">
       
<
class="menuTop" href="{X_SITEURL}index.php"Home </a>
<
class="menuMain" href="{X_SITEURL}modules/articles/article.php?id=17"Contact AJET </a>
<
class="menuMain" href="javascript:showMenu('ajetgroups');">AJET Groups </a>
<
div id="ajetgroups" style="display:none;">
<
class="menuSub" href="{X_SITEURL}modules/weblinks/viewcat.php?cid=1"Prefectural AJET Groups </a>
<
class="menuSub" href="{X_SITEURL}modules/weblinks/viewcat.php?cid=2"Special Interest Groups </a>
<
class="menuSub" href="{X_SITEURL}modules/weblinks/viewcat.php?cid=3"Nationality Groups </a>
<
class="menuSub" href="{X_SITEURL}modules/weblinks/viewcat.php?cid=26"Language Groups </a>
</
div>
<
class="menuMain" href="javascript:showMenu('publications');"Publications </a>
<
div id="publications" style="display: none;">
<
class="menuSub" href="http://aaj.ajet.net/"AJET Across Japan Magazine </a>
<
class="menuSub" href="http://ttp.ajet.net/"Team Taught Pizza </a>
<
class="menuSub" href="{X_SITEURL}modules/articles/article.php?id=18#hajet"Hokkaido AJET Publications </a>
<
class="menuSub" href="{X_SITEURL}modules/articles/article.php?id=18#hajet"Fukushima AJET Publications </a>
<
class="menuSub" href="{X_SITEURL}modules/articles/index.php?cat_id=8"E-Bulletins </a>
</
div>
<
class="menuMain" href="javascript:showMenu('services');"Services </a>
<
div id="services" style="display: none;">
<
class="menuSub" href="{X_SITEURL}modules/articles/article.php?id=19"AJET Peer Support Group </a>
<
class="menuSub" href="{X_SITEURL}modules/articles/article.php?id=21"Teaching Awards </a>
</
div>
<
class="menuMain" href="javascript:showMenu('faq');"FAQs </a>
<
div id="faq" style="display: none;">
<
class="menuSub" href="{X_SITEURL}modules/articles/article.php?id=3"English</a>
<
class="menuSub" href="{X_SITEURL}modules/articles/article.php?id=37">  &#12424;&#12367;&#12354;&#12427;&#12372;&#36074;&#21839; &#65288;&#26085;&#26412;&#35486;&#65289;</a>
</div>
<
class="menuMain" href="{X_SITEURL}modules/wfdownloads/"Downloads </a>
<
class="menuMain" href="{X_SITEURL}modules/weblinks/"Web Links</a>
</
td>
</
tr>
</
tbody>


There you have it a nice custom menu with expandable sub-links

hope it helps someone

ciao,

D.

5
davidl2
Re: custom sublinks in the mainmenu
  • 2006/11/18 7:52

  • davidl2

  • XOOPS is my life!

  • Posts: 4843

  • Since: 2003/5/26


replace tammairanslip with java script (without spaces)

Login

Who's Online

208 user(s) are online (141 user(s) are browsing Support Forums)


Members: 0


Guests: 208


more...

Donat-O-Meter

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

Latest GitHub Commits