Balok
10-18-2006, 03:33 PM
My goal is to provide links to the previous and next track on the track page. Seeing no tags for this, I thought to try Javascript. The simple code saved the current track in a variable. Then I attempted to iterate over all the tracks using <dax:track> and making a Javascript call inside each iteration. This appears to mess up the page context in some manner, for after attempting this valid HTML did not seem to work. Here's the Javascript:
<script language="javascript">
<!--
var thisTrackNum;
var prevTrackLink = "";
var nextTrackLink = "";
function saveTrackNum(trackNum)
{
thisTrackNum = trackNum;
}
function saveTrackLink(trackNum,trackLink)
{
if(thisTrackNum > 0 && trackNum == thisTrackNum - 1)
prevTrackLink = trackLink;
if(trackNum == (thisTrackNum + 1))
nextTrackLink = trackLink;
}
function printTrackLinks()
{
if (prevTrackLink.length > 0)
document.write("P:" + prevTrackLink.toString() + "<br>");
if (nextTrackLink.length > 0)
document.write("N:" + nextTrackLink.toString() + "<br>");
}
-->
</script>
And here's how it's invoked:
<script language="javascript">
<!--
saveTrackNum(<dax:tracknum/>);
-->
</script>
<dax:track>
<script language="javascript">
<!--
saveTrackLink(<dax:tracknum/>,"<dax:tracklink/>");
-->
</script>
</dax:track>
<script language="javascript">
<!--
printTrackLinks();
-->
</script>
<!-- bottom table -->
<!-- first row: lyrics and notes on left -->
<table class="trackbottom">
<tr>
<td class="left" id="lyrics">
<h3 class="topper">LYRICS
<dax:if($allow_edit)>
<span class="addedit">
<a href="#" onclick="window.external.edittrk(0,0,3); return false;">
<dax:if(lyrics||trackinstrumental)>(edit)<dax:else>(add)</dax:if>
</a></span>
</dax:if>
</h3>
<hr>
<p><dax:lyrics/></p>
When it reaches that <dax:lyrics> tag I get this message:
Unknown tag or section: 'lyrics' in C:\Program Files\OrangeCD\Templates\PaulB.dax at line 143, character 17.
<hr>
<p><dax:lyrics/></p>
</td>
Without the a <dax:track> construct the page loads fine, leading me to suspect that the <dax:track> construct doesn't work on a track page. But without it I see no way to obtain the previous and next track links, which is a feature I'd like in my template.
Any ideas?
<script language="javascript">
<!--
var thisTrackNum;
var prevTrackLink = "";
var nextTrackLink = "";
function saveTrackNum(trackNum)
{
thisTrackNum = trackNum;
}
function saveTrackLink(trackNum,trackLink)
{
if(thisTrackNum > 0 && trackNum == thisTrackNum - 1)
prevTrackLink = trackLink;
if(trackNum == (thisTrackNum + 1))
nextTrackLink = trackLink;
}
function printTrackLinks()
{
if (prevTrackLink.length > 0)
document.write("P:" + prevTrackLink.toString() + "<br>");
if (nextTrackLink.length > 0)
document.write("N:" + nextTrackLink.toString() + "<br>");
}
-->
</script>
And here's how it's invoked:
<script language="javascript">
<!--
saveTrackNum(<dax:tracknum/>);
-->
</script>
<dax:track>
<script language="javascript">
<!--
saveTrackLink(<dax:tracknum/>,"<dax:tracklink/>");
-->
</script>
</dax:track>
<script language="javascript">
<!--
printTrackLinks();
-->
</script>
<!-- bottom table -->
<!-- first row: lyrics and notes on left -->
<table class="trackbottom">
<tr>
<td class="left" id="lyrics">
<h3 class="topper">LYRICS
<dax:if($allow_edit)>
<span class="addedit">
<a href="#" onclick="window.external.edittrk(0,0,3); return false;">
<dax:if(lyrics||trackinstrumental)>(edit)<dax:else>(add)</dax:if>
</a></span>
</dax:if>
</h3>
<hr>
<p><dax:lyrics/></p>
When it reaches that <dax:lyrics> tag I get this message:
Unknown tag or section: 'lyrics' in C:\Program Files\OrangeCD\Templates\PaulB.dax at line 143, character 17.
<hr>
<p><dax:lyrics/></p>
</td>
Without the a <dax:track> construct the page loads fine, leading me to suspect that the <dax:track> construct doesn't work on a track page. But without it I see no way to obtain the previous and next track links, which is a feature I'd like in my template.
Any ideas?