html - list of submitted forms bootstrap/php -
i trying list of users submitted forms, each image, title, description , edit , delete button. trying them in list without numbers or bullets, 1 after another, not succeding, appreciated. thank in advance. here code:
<div class="container-fluid"> <p><a href="/validated/shows/create-show" class="btn btn-primary" role="button">create show</a></p> @if(sizeof($shows) > 0) @foreach($shows $index => $show) @if($index%3 == 0) <div class="row"> @endif <div class="col-sm-6 col-md-3"> <div class="thumbnail"> <img src="{{$show->path}}"> <div class="caption"> <h3>{{$show->title}}</h3> <p>{{$show->description}}</p> </div> <p><a href="/validated/shows/edit-show/{{$show->id}}" class="btn btn-primary" role="button">edit show</a></p> <form action="/validated/shows/delete-show" method="post"> <input type="hidden" name="_token" value="{{ csrf_token() }}" required> <input type="hidden" name="id" value="{{$show->id}}" required> <p><a href="/validated/shows/delete-show/{{$show->id}}" class="btn btn-primary" role="button">delete</a></p> </form> </div> </div> @if(($index+1)%3 == 0) </div> @endif @endforeach
it looks using php template engine in example, here solution on pure php without template engines. snippet output shows 3 per row.
<?php if(count($shows) > 0): ?> <div class="row"> <?php foreach($shows $index => $show): ?> <div class="col-sm-6 col-md-3"> <div class="thumbnail"> <img src="<?= $show->path ?>"> <div class="caption"> <h3><?= $show->title ?></h3> <p><?= $show->description ?></p> </div> <p> <a href="/validated/shows/edit-show/<?= $show->id ?>" class="btn btn-primary" role="button">edit show</a> </p> <form action="/validated/shows/delete-show" method="post"> <input type="hidden" name="_token" value="<?= csrf_token() ?>" required> <input type="hidden" name="id" value="<?= $show->id ?>" required> <p><a href="/validated/shows/delete-show/<?= $show->id ?>" class="btn btn-primary" role="button">delete</a></p> </form> </div> </div> <?php if( (($index + 1) % 3) == 0 && $index < (count($shows) - 1)): ?> </div> <div class="row"> <?php endif; ?> <?php endforeach; ?> </div> <?php endif; ?>
but if want responsove layout, exclude part code (as using bootstrap, work - see fiddle):
<?php if((($index + 1) % 3) == 0 && $index < (count($shows) - 1)): ?> </div> <div class="row"> <?php endif; ?>
Comments
Post a Comment