title: How Can I fillup bootstrap grid using foreach?
body: <p>As I am trying to make bootstrap grid structure using <code>foreach</code> two column and inside it's one row and two rows structure. Attached a screen shot for better to better view. </p>
  
  <p>Note: Not issue with CSS but first three items are goes in grid as picture. </p>
  
  <p>Counter is not taking <code>col-md-4</code> and not sure where to use Counter increment <code>counter++</code>? What if I want to show first three items using <code>foreach</code>?</p>
  
  <p>Any other way to workaround on this layout? Tried so far as below</p>
  
  <pre><code>  &lt;?php $counter = 0;
              foreach($view-&gt;result as $result) {
  
        &lt;div id="hot-post" class="row hot-post"&gt;      
              &lt;?php if( $counter == 0 || $counter % 3 == 0 ) {    ?&gt; 
              &lt;div class="col-md-8 hot-post-left"&gt;
                  &lt;div class="post post-thumb"&gt;
                      // first element common body 
  
                  &lt;/div&gt;
              &lt;/div&gt;
  
         &lt;?php if( $counter == 1 || $counter == 2 ) { ?&gt; 
            &lt;div class="col-md-4 hot-post-right"&gt;
             &lt;?php if( $counter == 1){ ?&gt;
                  &lt;div class="post post-thumb"&gt;
                      // second element common body 
                   &lt;/div&gt;
  
            &lt;/php if ( $counter == 2){
                  &lt;div class="post post-thumb"&gt;
                      // third element common body 
                   &lt;/div&gt;
            &lt;/div&gt;
           &lt;?php counter++; } } ?&gt;
         &lt;/div&gt; //closing row 
        &lt;?php } ?&gt;  //closing foreach 
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/wu7cr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wu7cr.png" alt="enter image description here"></a></p>