<% option explicit %> <% 'constants const pageId = "causes" const entriesPerPage = 8 'variables dim fileSystem 'the filesystem object dim objXML 'xml object dim entries 'array of entry objects in xml dim numEntries 'number of entries in the xml dim page 'which page we are on, from querystring dim defaultEntry 'the default entry number dim entry 'which entry to display, from querystring dim entryTitle 'the title of this entry dim entryDate 'when the entry was written 'dim entryPlace 'remove dim i 'loop counter dim causesDir 'the causes directory on the server 'dim thumbsDir 'the thumbnail directory on the server 'dim images 'the images in the image directory dim file 'the text file dim filename 'the text file name dim title 'entry title for sidebar dim path 'entry path for sidebar dim endline, tab endline = chr(10) tab = chr(9) 'Create instance of AspJpeg 'Set jpeg = Server.CreateObject("Persits.Jpeg") 'create the filesystem object set fileSystem = Server.CreateObject("Scripting.FileSystemObject") 'load the xml file Set objXML = Server.CreateObject("Microsoft.XMLDOM") 'do not do asynchronous download objXML.async = False 'load the document objXML.Load(Server.MapPath("xml/" & pageId & ".xml")) 'check for loading errors If objXML.parseError.errorCode <> 0 Then 'handle the error, do not continue processing! End If 'get all the gallery subtrees Set entries = objXML.getElementsByTagName("cause") numEntries = entries.length 'read which page we are on page = Request.querystring("page") 'if no parameter is passed if page = "" then 'default to first page page = 0 else page = cint(request.querystring("page")) end if 'calculate defaultEntry defaultEntry = page * entriesPerPage 'read which entry this is entry = Request.querystring("entry") 'if no parameter is passed if entry = "" then 'default to first entry entry = entries.item(defaultEntry).childNodes(xmlPath).text end if 'default to first entry in the list entryTitle = entries.item(defaultEntry).childNodes(xmlTitle).text entryDate = entries.item(defaultEntry).childNodes(xmlDate).text 'loop through all entries for i = 0 to (numEntries - 1) 'if we find a match, use that name instead if entry = entries.item(i).childNodes(xmlPath).text then entryTitle = entries.item(i).childNodes(xmlTitle).text entryDate = entries.item(i).childNodes(xmlDate).text exit for end if next 'get the folder on the server set causesDir = fileSystem.GetFolder(Server.MapPath("causes" )) 'get the files in the folder 'set images = imageDir.Files 'set file = filename = causesDir & "\" & entry & ".htm" 'response.write filename %> daveberlin.com
daveberlin.com:<%=pageId%>
<%=entryDate%>

<%=entryTitle%>

<% set file = fileSystem.openTextFile(filename) response.write file.readAll set file = nothing set fileSystem = nothing %>
style