sanus 0 Newbie Poster

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.