I would like to loop foreach in php using twitter bootstrap where the result would be like this.
I have tried in many ways with modulus etc. can anybody help me?
<div class="row">
<div class="col-md-6">Item 1</div>
<div class="col-md-6">Item 2</div>
</div>
<div class="row">
<div class="col-md-4">Item 3</div>
<div class="col-md-4">Item 4</div>
<div class="col-md-4">Item 5</div>
</div>
<div class="row">
<div class="col-md-6">Item 6</div>
<div class="col-md-6">Item 7</div>
</div>
<div class="row">
<div class="col-md-4">Item 8</div>
<div class="col-md-4">Item 9</div>
<div class="col-md-4">Item 10</div>
</div>
and so on.
thanks in advance
- I used the translator, sorry!
2
Answers
Assuming you’re outputting this from an array of data, here’s one way to do it:
The exact way you output the HTML is up to you.