I am trying to integrate a menu (transmenu) into my blog. To make this menu work, three different chunks of menuing code like the chunks below, need to appear in three different places in my templates. Since the content of my menu will be dynamic (changing based upon login credentials, etc.), it won't do to hard code the menu options, and I don't want to do three different function calls whenever I want to generate the code chunks.
The QUESTION!
Is it possible to write ONE function that would shove each of these chunks into three different variables {CHUNK1}, {CHUNK2}, {CHUNK3} that I could put in my templates? (So the code chunk1 below would go into my template as {CHUNK1}, chunk2 would be {CHUNK2}, etc.)...
Am I making any sense? If so, can someone help me understand what I need to do? I think I have seen where someone did something like this before. Help? :eek:
-(code chunk1 - goes in <head>)----------------------
<script language="javascript">
function init() {
if (TransMenu.isSupported()) {
TransMenu.initialize();
menu1.onactivate = function() { document.getElementById("liguria").className = "hover"; };
menu1.ondeactivate = function() { document.getElementById("liguria").className = ""; };
menu2.onactivate = function() { document.getElementById("lombardia").className = "hover"; };
menu2.ondeactivate = function() { document.getElementById("lombardia").className = ""; };
menu3.onactivate = function() { document.getElementById("veneto").className = "hover"; };
menu3.ondeactivate = function() { document.getElementById("veneto").className = ""; };
menu4.onactivate = function() { document.getElementById("toscana").className = "hover"; };
menu4.ondeactivate = function() { document.getElementById("toscana").className = ""; };
menu5.onactivate = function() { document.getElementById("lazio").className = "hover"; };
menu5.ondeactivate = function() { document.getElementById("lazio").className = ""; };
document.getElementById("umbria").onmouseover = function() {ms.hideCurrent();this.className = "hover";}
document.getElementById("umbria").onmouseout = function() { this.className = ""; }
}
}
</script>
-(code chunk2 - goes in <body>)----------------------
<div id="menu">
<a id="liguria" href="#">Liguria</a>
<a id="lombardia" href="#">Lombardia</a>
<a id="veneto" href="#">Veneto</a>
<a id="toscana" href="#">Toscana</a>
<a id="umbria" href="#">Umbria</a>
<a id="lazio" href="#">Lazio</a>
</div>
-(code chunk3 is long, but also goes in <body>)-----
Code chunk three is a long javascript chunk