使用单个答案显示多张图像

时间:2019-05-21 10:14:53

标签: php html css laravel

我正在处理以下代码,其中同一问题可以有多个图像作为答案。

因此,它们可以正确显示,但是对于每张图像,相同的问题会重复多次。

因此,我希望问题只显示一次,并且在下面显示答案。下面是代码。我创建了一个表格,图像将在问题后显示。同样在下面突出显示。我已经完成了一些POC,请看看。

<!--Question and Answer Section Open-->
@if($submited_documents->count() !=0)
    <table class="table table-bordered">
        <tbody>
            @if(count($submited_documents) > 0)
                @foreach($submited_documents as $documents)
                    <tr>
                        <th style="width:50% !important; border:1px solid lightgray;"><strong>Question{{$documents->sequence}} : </strong></th>
                        <th style="border:1px solid lightgray; "><strong>Answer : </strong></th>
                    </tr>
                    <tr>
                        <td>{{ $documents->question }}</td>
                        <td>{{ $documents->comments }}</td>
                    </tr>
                @endforeach
            @endif
        </tbody>
    </table>
    <table>
        <tbody>
            @foreach($submited_documents as $documents)
                <tr>
                    <td style="border-radius: 2px;">
                        <strong>Question{{$documents->sequence}} : </strong>{{ $documents->question }}
                    </td>
                </tr>
                @if(count($documents->pictures) > 0 )
                    @foreach($documents->pictures as $document_picture)
                        <tr>
                            <td class="td_class">
                                @if($document_picture->filename != null)
                                    <a style="" href="{{ URL::to('public/uploads/pickups/'.$document_picture->filename) }}" target="new">
                                    <img src="{{ URL::to('public/uploads/pickups/'.$document_picture->filename) }}"
                                         alt="{{ $document_picture->filename }}" title="{{ $document_picture->filename  }}"
                                         style="width: 50% !important;height: 50% !important;" ></a><br>
                                @endif
                            </td>
                        </tr>
                    @endforeach
                @endif
            @endforeach
        </tbody>
    </table>
@endif
<!--Question and Answer Section End-->

感谢您的帮助。

0 个答案:

没有答案