|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
readdir help
Hi people. I need some help with a readdir script.
The script I already have used on the site for a different section looks like this: <?php $date = date("md"); $handle=opendir('events'); while (($file = readdir($handle))!==false) { if ($file >= $date) { include("events/$file"); } } closedir($handle); ?> It compares the current month-day to the files which are named in the month-day format so that it displays only events that are current. What I need now is a script which only displays about 21 of the newest files, so that it doesn't ruin the sites layout. Also is there a way to designate in the files which one is the newest without putting it in the file name? Each file listing needs to be a link to that file, how would you accomplish this? Thanks. PS: Is there a way to get the readdir function to display the files in chronological order? |
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > readdir help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|