Here is my code
html>
<head></head>
<body>
<?php
$dir = 'folder/';
$files = scandir($dir);
$count=0;
foreach($files as $file){
$count++;
echo '<div style="float:left; margin: 0 0 10px 10px;border:1px solid #50A4AB; width:200px"><br>';
if(strpos($file,".php")){
include($dir.$file);
}
echo '</div><br>';
if($count==7){echo'<div style="clear:both;></div><br>';}
}
?>
</body>
</html>
First 2 divs empty and disordered, how to do proper div boxes with included php files, thanks in advance for any help..
Try setting directory to this:
$dir = '/folder';
Issue might be with your echo statements, you need to escape the quotes.
Try this:
echo "<div style=\"float:left; margin: 0 0 10px 10px;border:1px solid #50A4AB; width:200px \"><br>";
if($count==7){echo"<div style=\"clear:both;\"></div><br>";}
if the include are failing you can understand with die() function
include($dir.$file) or die('error in including '.$file);
and if you don't get any errors so your files are empty or not readable.