Last active
September 11, 2022 22:28
-
-
Save ridhotegar/21c513ba9b2236aeb1ff467972d74a86 to your computer and use it in GitHub Desktop.
Simple Foreach on Carousel Bootstrap
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
<div id='foto_villa' class='carousel slide' data-ride='carousel'> | |
<div class='carousel-inner'> | |
<?php $i=0; foreach ($foto as $row): ?> | |
<?php if ($i==0) {$set_ = 'active'; } else {$set_ = ''; } ?> | |
<div class='carousel-item <?php echo $set_; ?>'> | |
<img src='<?php echo $row->file; ?>' class='d-block w-100'> | |
</div> | |
<?php $i++; endforeach ?> | |
</div> | |
<a class='carousel-control-prev' href='#foto_villa' role='button' data-slide='prev'> | |
<span class='carousel-control-prev-icon' aria-hidden='true'></span> | |
<span class='sr-only'>Previous</span> | |
</a> | |
<a class='carousel-control-next' href='#foto_villa' role='button' data-slide='next'> | |
<span class='carousel-control-next-icon' aria-hidden='true'></span> | |
<span class='sr-only'>Next</span> | |
</a> | |
</div> |
Muito obrigado por compartilhares e ajudou bastante!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It helps for me. your efforts are amazing.
Thanks ridhotegar.