0

I have a problem in my Yii2 app that when i upload multiple images it will become totally unaligned. This is how it is https://i.stack.imgur.com/TfIla.png

I want to align contents vertically one after other when uploading multiple images . This is how i want https://i.stack.imgur.com/N30u6.png

And this is the code am using

<div class="people-nearby">
        <div class="nearby-user"> 
            <div class="row"> 
        <div class="col-md-2 col-sm-2">
             <?php
                          if (!empty($view)) {
                                   foreach ($view as $request) {
                       echo'
                    <div class="col-md-2 col-sm-2">
                     <img  src="'.$request['MediaPath'].'" alt="user" class="profile-photo-lg"/> 
                    </div>
                    <div class="col-md-7 col-sm-7">
                      <h5><a href="#" class="profile-link">'.$request['ContentName'].'</a></h5>

                        <p>File type</p>
                         <p class="text-muted">500m away</p> 
                    </div>
                   <div class="col-md-3 col-sm-3">
                       <button class="btn pull-right"><i class="ion-ios-trash"></i></button>
                  </div>

                            ';
                                  } }?>

</div>
  </div>
            </div>
      </div>
        </div>

Sorted out by myself. Changed code to

<?php
                      if (!empty($view)) {
                               foreach ($view as $request) {
                   echo'

        <div class="row"> 

                <div class="col-md-2 col-sm-2">
                 <img  src="'.$request['MediaPath'].'" alt="user" class="profile-photo-lg"/> 
                </div>
                <div class="col-md-7 col-sm-7">
                  <h5><a href="#" class="profile-link">'.$request['ContentName'].'</a></h5>
                   <p>File type</p>
                     <p class="text-muted">500m away</p> 
                </div>
               <div class="col-md-3 col-sm-3">
                   <button class="btn pull-right"><i class="ion-ios-trash"></i></button>
              </div>

  </div>     ';
                              } }?>

It's working fine now.

Solved the problem by inserting div inside the echo.

Edited by sanus

1
Contributor
0
Replies
27
Views
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.