hellonoko Posted October 14, 2008 Share Posted October 14, 2008 I have a simple script that list a directories contents. I am trying to cause it to insert double <br> tags whenever it detects files of a different day. Thus grouping the files by day modified. $olddate = 0; foreach($arr as $key => $value) { if ( $key !== "filelist3.php" && $key !== "index.php" ) { print "<object type=\"application/x-shockwave-flash\" data=\"http://www.sharingizcaring.com/button/musicplayer.swf?&song_url=http://www.sharingizcaring.com/REPOSITORY/$key&b_colors=,,ff0000,&\" width=\"17\" height=\"17\""; print "<param name=\"movie\" value=\"http://www.sharingizcaring.com/button/musicplayer.swf?&song_url=http://www.sharingizcaring.com/REPOSITORY/$key&b_colors=,,ff0000,&\"</object>"; //print "<img src=\"noflash.gif\" width=\"17\" height=\"17\" alt=\"\" />"; print "<span class=small_font><a href=\"http://www.sharingizcaring.com/REPOSITORY/$key\" class=".color()."> $key</a></span>"; echo $date = date("d", filemtime($key)); echo "<br>"; if ( $date !== $olddate && $olddate !== 0 ) { echo "<br>"; } $olddate = $date; } } It compares the modified day of the current file to that of the last one and if it finds a difference it causes a second <br> For some reason I can't get the second <br> to appear in the correct spot though. It is always one line too low. http://www.sharingizcaring.com/REPOSITORY/ Any ideas? Link to comment https://forums.phpfreaks.com/topic/128307-creating-double-spaces-based-on-day-file-was-modified/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.