skip to Main Content

I’m having a problem right now where my data exceeds 12 columns and it’s looking distorted.

enter image description here
enter image description here

I tried to fiddle around with my foreach position and add clearfix but it doesn’t work. How do I make sure that it will not exceed 12? Is it because there’s 2 foreach in a row?

<div class="row">
        <?php $count=0; foreach($model['organizations']['approve'] as $organization): ?>
        <div class="col-lg-4">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <span class="label label-primary pull-right"><a href="<?php echo $this->createUrl('/organization/view', array('id'=>$organization->id, 'realm'=>'cpanel')) ?>">Manage</a></span>


                    <h3 class=""><?php echo $organization->title ?></h3>



                </div>
                <div class="ibox-content">
                    <?php /*echo Html::image(ImageHelper::thumb(64, 64, $organization->image_logo), Yii::t('app', 'Logo Image'), array('class'=>"img-circle m-t-xs img-responsive"));*/ ?>
                    <span class="label label-primary pull-right"><a href="<?php echo $organization->url_website ?>" class=" <?php echo empty($organization->url_website)?'disabled':'' ?>" target="_blank">Visit</a></span>
                    <h6 class="no-margins">Website</h6>
                </div>
            <!--    <div class="btn-group btn-group-xs btn-group-justified">
                    <a href="<?php echo $this->createUrl('/organization/view', array('id'=>$organization->id, 'realm'=>'cpanel')) ?>" class="btn btn-success">Manage</a>
                    <a href="<?php echo $organization->url_website ?>" class="btn btn-white <?php echo empty($organization->url_website)?'disabled':'' ?>" target="_blank">Website</a>
                </div> -->
            </div>
        </div>

        <?php $count++; endforeach; ?>
        <div class="clearfix"></div>

        <?php $count=0; foreach($model['organizations']['pending'] as $organization): ?>
        <div class="col-lg-4">

            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <span class="label label-primary pull-right badge badge-warning" ">Pending</span>
                    <!-- <?php echo Html::image(ImageHelper::thumb(50, 50, $organization->image_logo), Yii::t('app', 'Logo Image'), array('class'=>"img-circle m-t-xs img-responsive")); ?>
                    -->
                    <h3 class="no-margins"><?php echo $organization->title ?></h3>
    <!--                  <small><?php echo $organization->text_oneliner ?></small>
    -->

    </div>
    <div class="ibox-content">
        <?php /*echo Html::image(ImageHelper::thumb(64, 64, $organization->image_logo), Yii::t('app', 'Logo Image'), array('class'=>"img-circle m-t-xs img-responsive"));*/ ?>
        <span class="label label-primary pull-right"><a href="<?php echo $organization->url_website ?>" class=" <?php echo empty($organization->url_website)?'disabled':'' ?>" target="_blank">Visit</a></span>
        <h6 class="no-margins">Website</h6>
    </div>
            <!--    <div class="btn-group btn-group-xs btn-group-justified">
                    <a href="<?php echo $this->createUrl('/organization/view', array('id'=>$organization->id, 'realm'=>'cpanel')) ?>" class="btn btn-success">Manage</a>
                    <a href="<?php echo $organization->url_website ?>" class="btn btn-white <?php echo empty($organization->url_website)?'disabled':'' ?>" target="_blank">Website</a>
                </div> -->
            </div>



        </div>
        <?php $count++; endforeach; ?>

        <div class="col-lg-4">
            <div class="contact-box full-width light-green-bg">
                <div class="col-xs-12">
                    <div class="center-block text-center margin-top-lg text-muted">
                        <a href="<?php echo $this->createUrl('organization/create', array('realm'=>'cpanel')) ?>"><i class="fa fa-plus-circle fa-2x"></i><br />Add</a>
                    </div>
                </div>
            </div>
        </div>



    </div>

Any help would be greatly appreciated!

2

Answers


  1. Hey try put this code before <div class="clearfix"></div>:

       <?php
        $count = 1;
        foreach ($model['organizations']['approve'] as $organization) {
    
            if ($count == 1 || $count % 3 == 1) {
                ?>
                <div class="row">
                <?php
            }
            ?>
            <div class="col-lg-4">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <span class="label label-primary pull-right"><a
                                href="<?php echo $this->createUrl('/organization/view', array('id' => $organization->id, 'realm' => 'cpanel')) ?>">Manage</a></span>
                        <h3 class=""><?php echo $organization->title ?></h3>
                    </div>
                    <div class="ibox-content">
                        <?php /*echo Html::image(ImageHelper::thumb(64, 64, $organization->image_logo), Yii::t('app', 'Logo Image'), array('class'=>"img-circle m-t-xs img-responsive"));*/ ?>
                        <span class="label label-primary pull-right"><a
                                href="<?php echo $organization->url_website ?>"
                                class=" <?php echo empty($organization->url_website) ? 'disabled' : '' ?>"
                                target="_blank">Visit</a></span>
                        <h6 class="no-margins">Website</h6>
                    </div>
                    <!--    <div class="btn-group btn-group-xs btn-group-justified">
                <a href="<?php echo $this->createUrl('/organization/view', array('id' => $organization->id, 'realm' => 'cpanel')) ?>" class="btn btn-success">Manage</a>
                <a href="<?php echo $organization->url_website ?>" class="btn btn-white <?php echo empty($organization->url_website) ? 'disabled' : '' ?>" target="_blank">Website</a>
            </div> -->
                </div>
            </div>
    
            <?php
            if ($count % 3 == 0) {
                ?>
                </div>
            <?php }
            $count++;
        }
        ?>
        <?php if ($count % 3 != 0) echo "</div>"; ?>
    
    Login or Signup to reply.
  2. You can try our this. I just modified @Sador’s answer. I hope it helps.

    <div class="row">
    <?php
    $count = 1;
    foreach ($model['organizations']['approve'] as $organization):
        ?>
        <div class="col-lg-4">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <span class="label label-primary pull-right"><a
                            href="<?php echo $this->createUrl('/organization/view', array('id' => $organization->id, 'realm' => 'cpanel')) ?>">Manage</a></span>
                    <h3 class=""><?php echo $organization->title ?></h3>
                </div>
                <div class="ibox-content">
                    <?php /* echo Html::image(ImageHelper::thumb(64, 64, $organization->image_logo), Yii::t('app', 'Logo Image'), array('class'=>"img-circle m-t-xs img-responsive")); */ ?>
                    <span class="label label-primary pull-right">
                        <a href="<?php echo $organization->url_website ?>" class=" <?php echo empty($organization->url_website) ? 'disabled' : '' ?>" target="_blank">Visit</a>
                    </span>
                    <h6 class="no-margins">Website</h6>
                </div>
                <!--    <div class="btn-group btn-group-xs btn-group-justified">
                <a href="<?php echo $this->createUrl('/organization/view', array('id' => $organization->id, 'realm' => 'cpanel')) ?>" class="btn btn-success">Manage</a>
                <a href="<?php echo $organization->url_website ?>" class="btn btn-white <?php echo empty($organization->url_website) ? 'disabled' : '' ?>" target="_blank">Website</a>
                </div> -->
            </div>
        </div>
        <?php if ($count % 3 == 0) { ?>
        </div>
        <div class="row"> 
            <?php
        }
        $count++;
    endforeach;
    ?>
    

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search