Home | Advertising Info60 USERS CURRENTLY ONLINE   
PowerASP
   Site Search Contact Us Wednesday, January 15, 2025  

  Active InfoActive Info  Display List of Info MembersMemberlist  Search The InfoSearch  HelpHelp
  RegisterRegister  LoginLogin
Classic ASP - General
 PowerASP Code Help Area : Classic ASP - General
Subject Info: array issues A d d  -  P o s tAdd P o s t
Author
Message << Prev Info | Next Info >>
grobar
Newbie
Newbie


Joined: February/25/2005
Online Status: Offline
Info: 1
Added: February/25/2005 at 12:03pm | IP Logged Quote grobar

Hello everyone

I have a photogallery site, where thumbnails are linked to counters. the photos are numbered: 01.jpg, 02.jpg...and so on. The count is stored in txt files with corresponding numbers: 01.txt, 02.txt...and so on.

I am trying to compose a script that will read the counts from all of the txt files, and then organize the way the thumbnaiils apper, in order from highest hits to lowerst. here is the code so far, and the url of the test page. any help getting this working would be appreciated. there are 10 images in the directory.


so far, the order is off, and not all of the images display.

The test page is located at http://www.robarspages.ca/devroot/p.../tempg/test.asp

(based on the current counts, if code is working correctly, images sound display in this order):

01.jpg
07.jpg
02.jpg
03.jpg
10.jpg
04.jpg
05.jpg
09.jpg
08.jpg
06.jpg

Code:

<%
Dim numArray(10)
Dim counter, imgindex, hitcount, FS, RS, filename, imgcounter, maximages
Set FS = Server.CreateObject("Scripting.FileSystemObject")

For counter = 1 to UBound(numArray)
filename = counter & ".txt"
If counter < 10 Then filename = "0" & filename
Set RS = FS.OpenTextFile(Server.MapPath("/devroot/photosite/tempg/cou nts") & "\" & filename,1)
numarray(counter)=RS.Readline
Next

maximages = 10

For imgcounter = 1 to maximages
hitcount = -1
For counter = 1 to UBound(numArray)
     If numArray(counter) > hitcount Then
      hitcount = numArray(counter)
      imgindex = counter
      'reset this so you don't count it again
      numArray(counter) = -1
     End If
Next
If imgindex < 10 Then imgindex = "0" & imgindex

Response.Write "<img src=""http://www.robarspages.ca/devroot/p...mpg/thumbnails/" & imgindex & ".jpg""><br><br>"

Next

%>




Edited by grobar on February/25/2005 at 12:04pm
Back to Top View grobar's Profile Search for other info by grobar
 

If you wish to make a comment to this info you must first login
If you are not already registered you must first register

  A d d  -  P o s tAdd P o s t
Printable version Printable version

Info Jump
You cannot add new info in this area
You cannot add to info in this area
You cannot delete your info in this area
You cannot edit your info in this area
You cannot create polls in this area
You cannot vote in polls in this area

   Active Server Pages Rule The World
Contact Us  
All artwork, design & content contained in this site are Copyright © 1998 - 2025 PowerASP.com and Christopher J. Williams
Banner ads ,other site logos, etc are copyright of their respective companies.
STATS Unless otherwise noted - All Rights Reserved.

Active Server Pages ASP a directory of ASP tutorials applications scripts components and articles for the novice to professional developer. CJWSoft ASPProtect ASPBanner ASPClassifieds www.aspprotect.com, www.cjwsoft.com,www.aspclassifieds.com,www.aspphotogallery.com