Re: here is another question.
by Kevin Waterson <kevin(at)oceania.net>
|
Date: |
Fri, 8 Oct 2004 07:29:43 +1000 |
To: |
hwg-techniques(at)mail.hwg.org |
References: |
earthlink |
|
todo: View
Thread,
Original
|
|
This one time, at band camp, Terry Goode <tgoode(at)earthlink.net> wrote:
> I have a page that displays pictures (the pictures are numbered, i.e.
> 1.jpg, 2.jpg, 3.jpg, 4.gif, whatever etc ), what i need is a way to
> display them "largest number first" along with the number# then
> descending down to number 1, this would save me about an hour per picture.
> This should be possible but i cant figure out how to do it..
Something like this in php will do it
<?php
$hdl = opendir('./');
while ($dirEntry = readdir($hdl)) {
if (substr($dirEntry, 0, 1) != '.')
{
$listing[] = $dirEntry;
}
}
natsort($listing);
closedir($hdl);
foreach($listing as $blah)
{
echo $blah.'<br />';
}
?>
---------
"Democracy is two wolves and a lamb voting on what to have for lunch.
Liberty is a well-armed lamb contesting the vote."
HWG hwg-techniques mailing list archives,
maintained by Webmasters @ IWA