Created
March 19, 2019 03:01
-
-
Save wplokal/8db2c18dee1fd6fb3d522f2f3cccddb9 to your computer and use it in GitHub Desktop.
Loop Row with Colum Bootstrap - PHP
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 | |
//Columns must be a factor of 12 (1,2,3,4,6,12) | |
$numOfCols = 4; | |
$rowCount = 0; | |
$bootstrapColWidth = 12 / $numOfCols; | |
?> | |
<div class="row"> | |
<?php | |
foreach ($rows as $row){ | |
?> | |
<div class="col-md-<?php echo $bootstrapColWidth; ?>"> | |
<div class="thumbnail"> | |
<img src="user_file/<?php echo $row->foto; ?>"> | |
</div> | |
</div> | |
<?php | |
$rowCount++; | |
if($rowCount % $numOfCols == 0) echo '</div><div class="row">'; | |
} | |
?> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment