I'm using DirectoryIterator to list files. In this scenario my dir contains 19 files.
I need to create a list which wraps 7 files into a <div>
.
I must be tired, because I'm not able to do this simple task.
My code is updated to reflect suggestions below:
$i = 0;
echo '<div class="first_div">';
foreach ($dir as $fileinfo) {
if ($fileinfo->isFile()) {
if(($i % 7 == 0) && ($i > 0) )
echo '</div><div>';
echo 'My file';
$i++;
}
}
echo '</div>';
Any help appreaciated.