<%@LANGUAGE="VBSCRIPT"%> Haliza Hashim <% PHOTOSPERSCREEN = 24 iPageNo = Request.QueryString("page") If Not IsEmpty(iPageNo) Then 'Return value is IsNumeric, else return 0 If IsNumeric(iPageNo) Then iPageNo = cint(iPageNo) Else iPageNo = 0 End If Else iPageNo = 0 End If if iPageNo = 0 then iPageNo = 1 iTotalFileCount = 0 Set objXMLDoc = CreateObject("Microsoft.XMLDOM") objXMLDoc.Async = "False" objXMLDoc.Load(Server.MapPath("images/gallery") & "\gallery.xml") Set objRoot = objXMLDoc.documentElement Set objNodeList = objRoot.getElementsByTagName("IMAGE") iTotalFileCount = objNodeList.length iPagesRequired = cint((iTotalFileCount / PHOTOSPERSCREEN) + 0.49) if iPageNo > iPagesRequired then iPageNo = iPagesRequired %>

Gallery

<% iFileCount = 0 iGoodFileCount = 0 iFileStart = ((iPageNo - 1) * PHOTOSPERSCREEN) + 1 For Each Elem In objNodeList iFileCount = iFileCount + 1 if (iFileCount >= iFileStart) and (iFileCount < iFileStart + PHOTOSPERSCREEN) then iGoodFileCount = iGoodFileCount + 1 SET caption = Elem.getElementsByTagName("CAPTION")(0) SET fileName = Elem.getElementsByTagName("FILE")(0) %>

<%=caption.text%>

<% if iGoodFileCount = PHOTOSPERSCREEN then exit for end if Next %>
    <% iFileCount = 0 iGoodFileCount = 0 iFileStart = ((iPageNo - 1) * PHOTOSPERSCREEN) + 1 For Each Elem In objNodeList iFileCount = iFileCount + 1 if (iFileCount >= iFileStart) and (iFileCount < iFileStart + PHOTOSPERSCREEN) then iGoodFileCount = iGoodFileCount + 1 SET fileName = Elem.getElementsByTagName("FILE")(0) %>
  • <% if iGoodFileCount = PHOTOSPERSCREEN then exit for end if Next Set objNodeList = nothing Set objRoot = nothing Set objXMLDoc = nothing %>
<% if iTotalFileCount > PHOTOSPERSCREEN then %>
 
<% end if %>