Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple question ... please answer :( 1

Status
Not open for further replies.

Technos

Programmer
Mar 15, 2002
47
US
hi,
I am pretty new to this field, looking for little help.
My problem:.
I'm showing thumbnails on the page. i'm reading the files directly from the folder using File system object and For each loop. but problem is all my pictures are showing in one row which we can't see(pictures are in individual cells). Now i have to break the rows ... How???? I have to show 4 pictures in each row. basically break the row after 4 cells....thanks
My code:

<table width=100% cols=4>
<tr align=left id=&quot;picRow&quot; name=&quot;picRow&quot;>
<% For Each file In t_files%>
<td id =&quot;numCell&quot; name=&quot;numCell&quot;>
<a href='<img src=' ...../<%=selEvent%>/thumbnails/<% Response.Write (file.name)%> ' border=0>
<p><%Response.Write fso.GetBaseName(file.name)%></p>
</a>
</td>
<% Next %>
</tr>
 
<table width=100% cols=4>
<tr align=left id=&quot;picRow&quot; name=&quot;picRow&quot;>
<%
counter = 0
For Each file In t_files
if counter <> 0 and (counter mod 4) = 0 Then Response.Write(&quot;</tr><tr align=left id=&quot;&quot;picRow&quot;&quot; name=&quot;&quot;picRow&quot;&quot;>&quot;)
counter = counter + 1
%>
<td id =&quot;numCell&quot; name=&quot;numCell&quot;>
<a href='<img src=' ...../<%=selEvent%>/thumbnails/<% Response.Write (file.name)%> ' border=0>
<p><%Response.Write fso.GetBaseName(file.name)%></p>
</a>
</td>
<% Next %>
</tr>

should work
 
I would set a variable like 'i' set it 1 outside the &quot;For each, Next&quot;.
<%
Dim i
i = 1
For...
%>

Then just before &quot;Next&quot; I would check and see if i=4, if so, Response.Write(&quot;</tr><tr>&quot;) and reset i=1, else increment it.

<% For Each file In t_files%>
<td id =&quot;numCell&quot; name=&quot;numCell&quot;>
<a></a>
</td>

<%
If i = 4 Then
Response.write(&quot;</tr><tr>&quot;)
i = 1
Else
i = i+1
End if
Next
%>

Lastly, what you will need to do, and unforuntely I have never really worked with fso before, I have to always blob my pictures. You need to determine when you are done reading files and finish out your last row, which is not really needed but for clean coding you should do it. And I think you can do it this way but I don't have the time to test it.

<%
...
Next

For i = i To 4 Step 1
Response.Write(&quot;<td> </td>&quot;)
If i = 4 Then Response.write(&quot;</tr>&quot;) End if
Next
%>

This should be pretty close to your answer, I hope it helps.

Wayne Sellars

&quot;Programming, today is a race between software developers, striving to build bigger and better idiot-proof programs, and the Universe, trying to produce bigger and better idiots. So far, Universe 1 - Programmers 0.&quot;
 
Thanks
The code is working
Hope to get your help again.
Thanks again
Technos
 
Technos,
I am trying to do the exact same thing you are with thumbnails. The code snippets shown in your post and the replies do not show the complete parts, i.e., what &quot;t_files&quot; is (an array of some sort?) and &quot;selEvent&quot; etc.

I would really like to see the whole code. I would be forever in your debt.

Thank you.

Thomerj
thomerj@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top