<% option explicit %> <% 'constants const pageId = "pictures" const galleriesPerPage = 10 'variables dim fileSystem 'the filesystem object dim objXML 'xml object dim galleries 'array of gallery objects in xml dim numGalleries 'number of galleries in the xml dim page 'which page we are on, from querystring dim defaultGallery 'the default gallery number dim gallery 'which gallery to display, from querystring dim i 'loop counter dim imageDir 'the image directory on the server dim thumbsDir 'the thumbnail directory on the server dim images 'the images in the image directory dim file 'one file from images dim filename 'the filename of an image dim title 'gallery title for sidebar dim path 'gallery path for sidebar dim endline, tab endline = chr(10) tab = chr(9) '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! response.write "ERROR-->" & objXML.parseError.errorCode & "<--" End If 'get all the gallery subtrees Set galleries = objXML.getElementsByTagName("gallery") 'get number of galleries numGalleries = galleries.length 'calculate defaultGallery 'defaultGallery = page * galleriesPerPage defaultGallery = 0 'read which gallery this is gallery = Request.querystring("gallery") 'if no parameter is passed if gallery = "" then 'default to first gallery gallery = galleries.item(defaultGallery).childNodes(xmlPath).text end if 'loop through all galleries for i = 0 to (numGalleries - 1) 'if we find a match, use that name instead if gallery = galleries.item(i).childNodes(xmlPath).text then exit for end if next 'given i and galleriesPerPage, determine the page we are on page = Int(i / galleriesPerPage) %> Gianni:Pisa
 

Images:

Construction 10/21/2006
Options and upgrades
Pisa Model