Displaying the available datesWe now have a filled in sDates array, that contains the dates of all the available newsletters. To display a list of them in the left column, and make them hyperlinks to the relevant newsletter I do this:for ( var nIssue=0; nIssue<nTotal; nIssue++ )
{
// add separators for date parsing
var sDate = sDates [ nIssue ];
sDate = sDate.substr ( 2, 2 ) + '/' + sDate.substr ( 4, 2 ) + '/20' + sDate.substr ( 0, 2 );
Out ( '<a href="Archives.asp?issue=' + nIssue + '">' + FormatDateDMYv ( sDate ) + '</a><p>' );
}
|
The values in the sDates array are similar to "010324", which relates to 24th March, 2001. The first few lines above split up the original string into a form that can be formatted by the FormatDateDMYv( ) function found in my utils/Format.asp SSI. The date is made into a hyperlink to "Archives.asp?issue=X", where X is the issue number. Note that Archives.asp is the current page, just with an optional parameter giving the newsletter to display. As we'll see next, if that parameter isn't supplied the latest newsletter is displayed - probably the one you'd want to see, right? Part 5: Displaying the newsletter... |