mcubedma Posted May 2, 2008 Share Posted May 2, 2008 Hello. I've used this code snippet to list directory contents, but it lists the contents in a line without blanks. For example, List of files: Autumn Leaves.jpgCreek.jpgDesert Landscape.jpgphpshow.phpindex.phpfilelist.php I'd like to have a line break between file names. Can anyone help me with this? <?php if ($handle = opendir(' . ')) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $thelist .= '<a href="'.$file.'">'.$file.'</a>'; } } closedir($handle); } ?> <P>List of files:</p> <P><?=$thelist?></p> Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted May 2, 2008 Share Posted May 2, 2008 add a "<br />" at the end of each file link... $thelist .= '<a href="'.$file.'">'.$file.'</a><br />'; Quote Link to comment Share on other sites More sharing options...
mcubedma Posted May 2, 2008 Author Share Posted May 2, 2008 Great. That worked perfectly. Thank you very much. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.