Wednesday, March 1, 2017

How to put div in every 5th row laravel

I would like to put another code of div in every 5th row. Something like:

@foreach ($vip_ads as $key=>$ad)
        @if($key%30==0)         {
            <div></div>
        }
        @include('front.ad.ad_template.view')
@endforeach
@foreach ($ads as $key=>$ad)
        @if($key%30==0)         {
            <div></div>
        }
        @include('front.ad.ad_template.view')
@endforeach

My laravel version is 4. So I can't use new loop->iteration function. The problem is that it doesn't give a new block to a div. Everything in one line, meanwhile I need to close 5th row (6 columns total 30 elements) and put a new div, after that continue with the given $key value until it gets for example 60. And the next problem is that I could have less than 10 values in $vip_ads, but in total it has to be 30 for both $vip_ads and $ads. Sorry, for my english. Example of this can seen at http://ift.tt/2lxLRtD




via Tracker7

Advertisement