我在这里使用fancybox:
@foreach($galleries as $gallery)
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3">
@if($id != null)
<a id="{{$id}}" class="fancybox-buttons img-holder small-img" rel="gallery" title="" data-fancybox-group="button"
href="/storage/galleries/{{$gallery->image}}">
@else
<a id="{{$gallery->id}}" class="fancybox-buttons img-holder small-img" rel="gallery" title="{{$gallery->id}}" data-fancybox-group="button"
href="/storage/galleries/{{$gallery->image}}">
@endif
<img src="/storage/galleries/{{$gallery->image}}" alt="img">
</a>
</div>
@endforeach
我有一个fancybox函数,并且afterload选项具有这样的共享链接:
afterLoad : function() {
id = this.title;
this.title =
'<a href="https://twitter.com/intent/tweet?url={{ urlencode(Request::fullUrl())}}/(id variable)" class="btn btn-tw btn-small"><i class="fa fa-twitter right-fa"></i> Share</a>';
}
我想将此变量id添加到href中,如果php有另一种解决方法,那也很好
答案 0 :(得分:2)
您可以这样添加id
:
'<a href="https://twitter.com/intent/tweet?url={{ urlencode(Request::fullUrl())}}/' + id + '" class="btn btn-tw btn-small"><i class="fa fa-twitter right-fa"></i> Share</a>';
答案 1 :(得分:0)
我找到了这样的答案:
'<a href="https://twitter.com/intent/tweet?url={{ urlencode(Request::fullUrl()) }}/'+id+'" class="btn btn-tw btn-small"><i class="fa fa-twitter right-fa"></i> Share</a>'