Bluehost.com Web Hosting $6.95

Re: [PHP] File ordering

This is a discussion on Re: [PHP] File ordering within the PHP General forums, part of the PHP Programming Forums category; > I am doing a 'readdir' on a subdirectory. I did my file naming counting on > it ordering based ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 08-12-2003
Lowell Allen
 
Posts: n/a
Default Re: [PHP] File ordering

> I am doing a 'readdir' on a subdirectory. I did my file naming counting on
> it ordering based on numbering... But when I do the readdir it isn't doing
> it. My naming convention 002_2003_66.jpg would indicate the 66th picture for
> the month of Feb in 2003. This gave me automatic sorting. So I thought. But
> it doesn't seem to be doing it. The server is a linux server
> ((IStop/Doncaster consulting) and I don't see why the ordering is screwing
> up. I checked the create dates and that isn't the ordering choosen (I have
> pictures from July showing up between pictures from March).
>
> Thoughts, suggestions?
>
> Katherine
>
> This is the clip of code(srcdir being passed in):
>
> $imgdir = "$srcdir/images";
> $txtdir = "$srcdir/txt";
> $imgdh = opendir($imgdir);
> $txtdh = opendir($txtdir);
>
> while($file = readdir($imgdh)) {
> if(substr($file,-3)=="jpg") {
> $imgFiles[] = $file;
> $textFileName = substr($file,0,-3)."txt";
> $textFiles[] = $textFileName;
> }
> }


Just sort the $imgFiles array.

--
Lowell Allen

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 12:57 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0