嗨,我有这个为循环的div组,其中包含来自数据库的数据,这是它的样子
这是我生成这些div的代码
@foreach($NSAdata as $list)
{{ Session::put('isList' , 'true')}}
<div class="divcont">
<p>Filename : {{$list->filename}}</p>
<span>Size : {{$list->filesize}}</span>
@if($list->filetype == 'ppt' || $list->filetype == 'pptx')
<img src="{{ asset('img/ico/pptico.PNG') }}" class="imgicoII">
@elseif($list->filetype == 'doc' || $list->filetype == 'docx')
<img src="{{ asset('img/ico/wordico.PNG') }}" class="imgicoII">
@elseif($list->filetype == 'pdf')
<img src="{{ asset('img/ico/pdfico.PNG') }}" class="imgicoII">
@elseif($list->filetype == 'xls' || $list->filetype == 'xlsx')
<img src="{{ asset('img/ico/excelico.PNG') }}" class="imgicoII">
@elseif($list->filetype == 'txt')
<img src="{{ asset('img/ico/txtico.png') }}" class="imgicoII">
@elseif($list->filetype == 'csv')
<img src="{{ asset('img/ico/csvico.PNG') }}" class="imgicoII">
@endif
<br>
@if($list->thumbnail != 'n/a')
<img src="{{ asset('uploads/docs/thumb/' . $list->thumbnail ) }}" class="imgicoIII">
@else
<img src="{{ asset('uploads/docs/thumb/noThumb.png' ) }}" class="imgicoIII">
@endif
<br>
<a class="modal-trigger z-depth-1 btn dgray " href="#modFile">
Edit
</a>
<a href="{{URL::route('openfile', array($list->fileid))}}" class="btn dgray">
View
</a>
</div>
@endforeach
当用户点击编辑按钮时,我触发一个id为modFile
的模态,它应该显示一个模态,其中包含来自点击的div的数据,我能够显示模态,但我不显示正确的数据。这是我的模态代码
<div id="modFile" class="modal modal1size">
<div id="modal-header" class="z-depth-2 blue lighten-1">
</div>
<div class="modal-content">
<div class="row rowMarg">
<h6>Information.</h6>
@if(Session::has('isList'))
<h6>Filename : {{ $list->filename }} </h6>
<h6>File type : {{ $list->filetype }} </h6>
<?php $extension = "";?>
@if($extension == 'ppt' || $extension == 'pptx')
<img src="{{ asset('img/ico/pptico.PNG') }}" class="imgico">
@elseif($extension == 'doc' || $extension == 'docx')
<img src="{{ asset('img/ico/wordico.PNG') }}" class="imgico">
@endif
<h6>Size : {{ $list->filesize }} </h6>
<br>
@endif
</div>
</div>
<div class="modal-footer grey lighten-4">
<button type="submit" class="waves-effect waves-darkblue-1 btn-flat buttoninset">Submit</button>
<a href="#!" class=" modal-action modal-close waves-effect waves-darkblue-1 btn-flat buttoninset">Cancel</a>
</div>
事情是它只是显示错误的信息,知道我做错了什么或如何改进我的代码?