I want to relate some products that I get from database with the carousel of the home page. However there's a "active" class in the carousel and I call the data with a foreach like this:
<?php foreach($products as $product):?>
<div class="carousel-item active">
<img src="<?=$urlImg.$product['image_main']?>" class="d-block w-100" alt="...">
<div class="carousel-caption d-none d-md-block">
<h5><?=$product['title']?></h5>
</div>
</div>
<?php endforeach;?>
Is there a way that I could make this work? How can I work with this "active" class with php?
Aucun commentaire:
Enregistrer un commentaire