Is there a way to create multiple rows of thirds using w3.css and a foreach loop also to populate the thirds with data from a sample database?
Tried using but this would create multiple thirds in a single row instead:
<?php foreach ($products as $index => $product) :?>
<div class="w3-row">
<?php foreach ($products as $index => $product) : ?>
<div class="w3-third w3-container">
<h2>product 1 </h2>
</div>
</div>
<?php endforeach; ?>
</div>
<?php endforeach; ?>
Expected output:
<div class="w3-row">
<div class="w3-third w3-container">
<h2>Item 1 from a database</h2>
</div>
<div class="w3-third w3-container">
<h2>Item 2 from a database</h2>
</div>
<div class="w3-third w3-container">
<h2>Item 3 from a database</h2>
</div>
</div>
<div class="w3-row">
<div class="w3-third w3-container">
<h2>Item 4 from a database</h2>
</div>
<div class="w3-third w3-container">
<h2>Item 5 from a database</h2>
</div>
<div class="w3-third w3-container">
<h2>Item 6 from a database</h2>
</div>
</div>