<% Response.Expires=30 ' Server.ScriptTimeout=30 ' %> *******HOMEBAKE 2001 - NEWS*********
    HOMEBAKE 2001    Saturday December 8th   2001    The Domain   Sydney     
info
bands
tickets
archive
site map
the domain
garage days
playing times
homebake cd
band interviews
artist of the week
 News

The SuperJesus

 

1200 Techniques

  Bookmark this page, keep up with our news..

<% Function FormatDate(MyStr) ' -------------------------------------------------- ' Function FormatDate() ' ' Returns a string formatted to grab news file by name. ' Form: mm_dd_yyyy OR dd_mm_yyyy ' The locale type of the server machine will dictate the ' name of the news file. ' ' -------------------------------------------------- Dim strChars, badString, i strChars = "/\?:-,. " ' Check each char for invalid characters and replace with "_" For i = 1 To Len(MyStr) badString = Mid(strChars, i, 1) MyStr=replace(MyStr,badString,"_") Next ' Pass back formatted string. FormatDate = MyStr End Function '*********************************************************************** '* This apprach is a KISS solution to avoid the need to '* create a database management system. '* Adrian Green '*********************************************************************** ' EDITABLE CONSTANTS '************************************ '*********************************************************** Const PATH="tmpdata" 'Path to folder that holds news files 'relative to this page. Const SFILEEXT=".html" 'extention for news file (they can be html) Const LNUMDAYSLOOKBACK = -30 'Num days to look back before giving up. 'Note: use a negative number. Const LNUMFILESDISPLAY = 3 'You can show [starting from today] any number 'previous news files on this page... '*********************************************************** '*********************************************************** Dim sNewsFile 'File name in include in output Dim theDate 'Buid filename from this. Dim i,j ' Dim fs Set fs=Server.CreateObject("Scripting.FileSystemObject") i=0:j=0 theDate = Date() On Error Resume Next 'Loop backwards from Server machines current date (hopefully correct!) 'and look for most recent file if todays file is not found... 'Displays [most recent 1st] number of files specified in LNUMFILESDISPLAY do until (i <= LNUMDAYSLOOKBACK) or (j>LNUMFILESDISPLAY) i=i-1 sNewsFile=( PATH & "\" & FormatDate(theDate) & SFILEEXT ) if (fs.FileExists(Server.MapPath(sNewsFile))) then Server.Execute( sNewsFile ) 'Include page if Err.number<>0 then'debug 'Response.Write "

" & sNewsFile & "
" 'Response.Write Err.Description & "
" 'Response.Write Err.number & "
" end if j=j+1 'inc Number Files to include end if theDate = DateAdd("d", i, Date())'Decrement date -1 loop Set fs=Nothing On Error Goto 0 %>

 Sign up here to receive regular updates by e mail.

Your e mail address: click once:

    HOMEBAKE 2001    Saturday December 8th   2001    The Domain   Sydney     

Homebake 2001. All pages ©. Web design by T Force • Advertise on this site enquire here