[thelist] How to put a date-limit on SSIs?

George Dillon george.dillon at ukonline.co.uk
Wed Jan 31 19:15:48 CST 2001


Is there a way to use XSSI to include a file but only before a given date?

I have a page on my own site which lists forthcoming performances, and I'd
like it to effectively update itself (by not including the info about past
dates).  I'm currently achieving what I want using client-side Javascript,
but I'd rather do it using only XSSI if possible.

Here's the URL: http://www.georgedillon.com/theatre/tour2001.shtml

The relevant SSI to determine today's date runs:

<!--#config timefmt="%y" -->
var Var_y=<!--#echo var="DATE_GMT"  -->;
<!--#config timefmt="%m" -->
var Var_m=<!--#echo var="DATE_GMT"  -->;
<!--#config timefmt="%d" -->
var Var_d=<!--#echo var="DATE_GMT"  -->;
Var_date=10000*Var_y+100*Var_m+Var_d;

The info about the dates on the tour looks a bit like this:

i=0;gigs=new Array();
i+=1;gigs[i]=new Array("010218","Tues - Sun","6th - 18th Feb","LONDON","The
King's Head","020 7226 1916")
i+=1;gigs[i]=new Array("010427","Wed - Fri","25 - 27 Apr","MANCHESTER","The
Green Room","0161 950 5900")

And the Javascript to determine whether or not to write the table row is:

gigstring=""
for (i=1;i<=gigs.length-1;i++)
{
if(Var_date<=gigs[i][0])
 {
 gigstring+="<tr>"
 for (j=1;j<=5;j++)
  {
  gigstring+="<td"
  if(j==3){gigstring+=' class="h4"'}
  gigstring+=">"+gigs[i][j]+"<\/td>"
  }
 gigstring+="<\/tr>"
 }
}
document.write(gigstring)

So how can I do this better?

TIA

George Dillon





More information about the thelist mailing list