Julian Martin wrote:

> while (defined($file = readdir(DIR))) {
>  
>       next if $file =~ /^\.\.?$/;
>       %>
>       <tr width="500">
>               <td width="200"><a href="images/<%=$file%>"><img
> src="images/thumbs/<%=$file%>"></a></td>
>               <td width="200"><h3><%$file%></h3></td>
>       </tr>
>       <%      
> }
> 
> This while loop does for each file in the dir, but I don't want to place
> each one on a new line. I would like to place three side by side before
> going to next line. Can I do it using this loop or do I need a different one
> ?
> 
> This e-mail, and any attachment, is confidential. If you have received it in
> error, please delete it from your system, do not use or disclose the
> information in any way, and notify me immediately.


Just set a vrbl to 0 and when the vrbl is 0 output the <tr> etc.
When the vrbl is 2, output the </tr> etc and reset the vrbl to 0.

Something like this in regular Perl syntax:

my $set = 0;
while (defined ($file = readdir(DIR))) {

        next if $file =~ /^\.\.?$/;

        if ($set == 0) {
                print qq{<tr width="500">}
        }

        print qq{<td width="200"><a href="images/<%=$file%>"><img 
src="images/thumbs/<%=$file%>"></a></td>};

        print qq{<td width="200"><h3><%$file%></h3></td>};

        $set++;
        if ($set > 2) {
                print qq{</tr>};
                $set = 0;
        }
}




-- 
   ,-/-  __      _  _         $Bill Luebkert   ICQ=14439852
  (_/   /  )    // //       DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--<  o // //      http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/_<_</_</_     Castle of Medieval Myth & Magic http://www.todbe.com/

_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin

Reply via email to