The following works really well:
I found some code for dynamic image galleries over at
Dynamic Drive, which contains a small page numbering function that works cross-browser.
FIRST I take the part I needed and modified it thusly:
CODE
/*
MT Archive Page Numbering by John Fairley (john@bostich.com) based on:
Interactive Image slideshow with text description
By Christian Carlessi Salvadó (cocolinks@c.net.gt). Keep this notice intact.
Visit http://www.dynamicdrive.com for script
*/
g_iimg = 0;
g_imax = 0;
g_PageTable = new Array();
<MTArchiveList>g_PageTable[g_imax++] = new Array ("<MTEntries><$MTEntryID$></MTEntries>");</MTArchiveList>
function getobject(obj){
if (document.getElementById)
return document.getElementById(obj)
else if (document.all)
return document.all[obj]
}
function setPageNumber(myPage){
var inputPage = myPage;
for (var i = 0; i < g_PageTable.length; i++) {
if (inputPage == g_PageTable[i][0]){
g_iimg = i;
}
}
getobject("_Ath_Img_X").innerHTML = g_iimg + 1;
getobject("_Ath_Img_N").innerHTML = g_imax;
}
Make it a new Index Template, with a .js extension.
SECOND Include it like any other .js file in your archive template, and add the following onLoad event to the template:
CODE
<body "setPageNumber(<$MTEntryID$>);">
FINALLY Add the following SPANs to your archive tempalte:
CODE
<SPAN id="_Ath_Img_X"></SPAN>
<SPAN id="_Ath_Img_N"></SPAN>
------------------------------------------------
All this just compares the MTEntryID's of the page and Array, and spits out the numbers.
Seems to work fine, and of course it's auto-updating everytime you publish a new page.
john.,