0
Php and bootstrap
I have a function that gets products from the database.my theme create with bootstrap 4. col-3 for my sidebar and col-9 for my content. How do I call a function to have 3 products in each row? When i use <div class="col_9"> <div class="col_4"> Myproduct(); </div> <div class="col_4"> Myproduct(); </div> <div class="col_4"> Myproduct(); </div> </div> My function is repeat in each col
1 Answer
+ 13
Use "for" or "foreach":
for ($i = 0; $i < $numberOfProducts; $i++) {
echo '<div class="col_4">' . Myproduct(). '</div>' ;
}