Re: [PHP] need help arranging files!
Hmm, I just set-it-up on my server: http://www.ambiguism.com/php/readDirSort.php Seems to work for me. Code: -snip- Hth! Cheers, Micky Micky: Worked great for me -- no problems whatsoever! Thanks. tedd -- http://sperling.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] need help arranging files!
You can locate a good directory reading script at http://www.weberdev.com/get_example-1456.html Thanks, Richard On 1/17/06, Nicholas Couloute [EMAIL PROTECTED] wrote: I need to know how to arrange files alphabetically in my directory when I display it on the browser! I have it display the filename foreach that exist is there a way to arrange by alphabet? ~Nick Couloute co-owner/web Designer SiDEkiCk2MuSiC.CoM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] need help arranging files!
On Jan 17, 2006, at 7:09 AM, tedd wrote: Worked great for me -- no problems whatsoever! Sweet, thanks for checking... glad someone got it working. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] need help arranging files!
Weberdev.com is a nice site! On Tue, 17 Jan 2006 11:34 am, Richard Correia wrote: You can locate a good directory reading script at http://www.weberdev.com/get_example-1456.html Thanks, Richard On 1/17/06, Nicholas Couloute [EMAIL PROTECTED] wrote: I need to know how to arrange files alphabetically in my directory when I display it on the browser! I have it display the filename foreach that exist is there a way to arrange by alphabet? ~Nick Couloute co-owner/web Designer SiDEkiCk2MuSiC.CoM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ~Nick Couloute co-owner/web Designer SiDEkiCk2MuSiC.CoM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] need help arranging files!
I need to know how to arrange files alphabetically in my directory when I display it on the browser! I have it display the filename foreach that exist is there a way to arrange by alphabet? ~Nick Couloute co-owner/web Designer SiDEkiCk2MuSiC.CoM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] need help arranging files!
On Jan 16, 2006, at 5:21 PM, Nicholas Couloute wrote: I need to know how to arrange files alphabetically in my directory when I display it on the browser! I have it display the filename foreach that exist is there a way to arrange by alphabet? I would read the contents of the directory into an array, then use the sort()[1] function. Example code (wrote the below code so I could generate a dynamic html drop-down menu): ... ... ... $the_dir = opendir($file_path); # Loop through directory and add files to array $html: while ($file = readdir($the_dir)) { # Check if it's a file, and it has a valid extension: if(eregi((\.html|\.htm|\.php|\.txt)$, $file)) { # Add file to array $html: $html[] = $file; } } # Close the stream: closedir($the_dir); # Generate the drop-down menu: if($html == null) { die(There are no files in this directory!); } // If no content is found, alert user. ... ... ... From here, in your case, I would just apply one of the PHP sort functions on the $html var and then print/echo your results from there... [1] http://us3.php.net/manual/en/function.sort.php Hth, Cheers, Micky -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] need help arranging files!
On Jan 16, 2006, at 6:10 PM, Nicholas Couloute wrote: I tried the script but it keeps saying it is not an array! Hmm, I just set-it-up on my server: http://www.ambiguism.com/php/readDirSort.php Seems to work for me. Code: $file_path = $_SERVER['DOCUMENT_ROOT'].'/php/test/'; $the_dir = opendir($file_path); # Loop through directory and add files to array $html: while ($file = readdir($the_dir)) { # Check if it's a file, and it has a valid extension: if(eregi((\.pdf|\.html|\.htm|\.php|\.txt)$, $file)) { # Add file to array $html: $html[] = $file; } } # Close the stream: closedir($the_dir); # Generate the drop-down menu: if($html == null) { die(There are no files in this directory!); } // If no content is found, alert user. sort($html); foreach($html as $html = $value) { echo 'br /'.$value; } Keep in mind, the above code is very minimal... you could probably spend a bit of time making more secure/robust... I pulled it out of a function I use. You might want to read-up on sorting via PHP.net (in comments section) for more robust user-defined functions... Hth! Cheers, Micky -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] need help arranging files!
can any one help me out? plz ~Nick Couloute co-owner/web Designer SiDEkiCk2MuSiC.CoM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] need help arranging files!
I figured it out! it runs on my pc but not on the web! $fileroot = amrs/$cat/; foreach ($author = scandir($fileroot); as $author){ echo $author; } ??? ~Nick Couloute co-owner/web Designer SiDEkiCk2MuSiC.CoM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php