GaijinPunch
MIS
Okay -- quick summary:
I've got a lot of thumbnails in a directory, and I want to display 15 on each page, and have a next button to grab the next 15.
Here's what I've got to feed the dirlist of thumbnails into the array:
opendir DIR, ".";
@thumbs = grep /1s.jpg/i, readdir(DIR);
foreach $_ (@thumbs) {
print "$_\n";
}
So, the above will print them all out (I'm only working w/ a shell right now -- not w/ HTML, but I'll worry about that later.
I tried using something like
opendir DIR, ".";
@thumbs = grep /1s.jpg/i, readdir(DIR);
$count = 0
foreach $_ (@thumbs) {
while ($count < 15) {
print "$_\n";
$count += 1;
}
}
but for some reason, that just printed the first one 15 times, so I'm thinking I should print it out according to it's order in the array.
However, after thinking about it, that doesn't seem too dynamic. I want to eventually just throw thumbnails in the folder, and not have to adjust the script.
On that note, would the 'next' button I'm wanting actually hold a variable and reload the script? I'm not quite sure how it would know to load the next 15 instead of the first 15 again.
I'm looking for ideas here more than code I think, although some of the code wouldn't hurt.
Thanks.
I've got a lot of thumbnails in a directory, and I want to display 15 on each page, and have a next button to grab the next 15.
Here's what I've got to feed the dirlist of thumbnails into the array:
opendir DIR, ".";
@thumbs = grep /1s.jpg/i, readdir(DIR);
foreach $_ (@thumbs) {
print "$_\n";
}
So, the above will print them all out (I'm only working w/ a shell right now -- not w/ HTML, but I'll worry about that later.
I tried using something like
opendir DIR, ".";
@thumbs = grep /1s.jpg/i, readdir(DIR);
$count = 0
foreach $_ (@thumbs) {
while ($count < 15) {
print "$_\n";
$count += 1;
}
}
but for some reason, that just printed the first one 15 times, so I'm thinking I should print it out according to it's order in the array.
However, after thinking about it, that doesn't seem too dynamic. I want to eventually just throw thumbnails in the folder, and not have to adjust the script.
On that note, would the 'next' button I'm wanting actually hold a variable and reload the script? I'm not quite sure how it would know to load the next 15 instead of the first 15 again.
I'm looking for ideas here more than code I think, although some of the code wouldn't hurt.
Thanks.