Hi there!
I am new to Drupal, but have spent the day installing and messing around.
I have 3 content sites that I would like to consolidate into one drupal site. Each site has several subcategories, so for lack of better knowledge, I thought the easiest way to do it in Drupal is to create 4 categories (aka "vocabulary") and underneath each one the subcategories (aka "terms").
Then I wanted to have them displayed in their own box as headers ("vocabulary") only, which would then upon click on the header dynamically (via Javascript) open the "terms" underneath, each term linked to the actual subsection, and close it again upon another click on the header - a toggle, so to say.
It took me a while, but now it's working nicely, and I'd like to share the results with you. If you think it's not so clean or there is a better way, please let me know. I'm keen to learn. :)
Instructions:
- Save this as menu-builder.inc in your /includes directory
<?php
$js="
<SCRIPT LANGUAGE=\"JavaScript\"><!--
function ShowHide(divId, divId2, divId3) {
var id = document.getElementById(divId);
var id2 = document.getElementById(divId2);
var id3 = document.getElementById(divId3);
if (id.style.display == \"none\") {
eval(\"id.style.display = 'block'\");
eval(\"id2.style.display = 'none'\");
eval(\"id3.style.display = 'block'\");