I am using DirectoryIterator to display files. In this scenario, my directory contains 19 files.
I need to create a list that wraps 7 files in <div>.
I have to get tired because I cannot complete this simple task.
My code has been updated to display the sentences 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 could be fixed.
source
share