dongwei3120 2019-05-21 10:14
浏览 39

单一答案显示多个图像

I am working on the below code, where the same question can have multiple images as an answer.

So, they are displaying properly but, with every image, the same question is repeating multiple times.

So, I want the question to display only once and below that the answers should be displayed. Below is the code. I have created a table and the images will be displayed after the question. Same has been highlighted below. I have done some POC, please have a look.

<!--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-->

Any help is appreciated..

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 winform的chart曲线生成时有凸起
    • ¥15 msix packaging tool打包问题
    • ¥15 finalshell节点的搭建代码和那个端口代码教程
    • ¥15 用hfss做微带贴片阵列天线的时候分析设置有问题
    • ¥15 Centos / PETSc / PETGEM
    • ¥15 centos7.9 IPv6端口telnet和端口监控问题
    • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
    • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
    • ¥20 海浪数据 南海地区海况数据,波浪数据
    • ¥20 软件测试决策法疑问求解答