Created
September 16, 2017 23:02
-
-
Save lekankoku/604c1645adc5cef70008f70414f6559d to your computer and use it in GitHub Desktop.
Dynamic Bootstrap Row and Column Maker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$numberOfColumns = 3; | |
$bootstrapColWidth = 12 / $numberOfColumns ; | |
$chunkArray = array_chunk($items, $numberOfColumns); | |
foreach($chunkArray as $items) { | |
echo '<div class="row">'; | |
foreach($items as $item) { | |
echo '<div class="col-md-'.$bootstrapColWidth.'">'; | |
// your item | |
echo '</div>'; | |
} | |
echo '</div>'; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment