Need some clues with the rest of this script:
// Num of columns
$col = 3;
foreach ($schema as $key => $array) {
// wrapper div
if($key % $col == 0) {
echo '<div class="wrapper" style="float: left;">;
}
// divs inside columns
foreach ($array as $c => $value) {
echo '<div开发者_如何学Python>' . $value . '</div>';
}
// Here I need to close wrapper div
// @ to do
}
// Num of columns
$col = 3;
echo '<div class="wrapper" style="float: left;">';
$count = 1;
foreach ($schema as $key => $array) {
// wrapper div
if($count % $col == 0) {
echo '</div>';
if(isset($schema[$key+1])) // check if next element exists then start new div
echo '<div class="wrapper" style="float: left;">';
}
// divs inside columns
foreach ($array as $c => $value) {
echo '<div>' . $value . '</div>';
}
$count++;
}
if(count($schema) % $col != 0)
echo '</div>'; // at last close div
精彩评论