虽然maccms本身提供有{$obj.vod_rel_vod}这样的关联字段,但实际应用中采集到的{$obj.vod_rel_vod}却空的,一条一条的去添加不现实,这里想到了另一种方法:通过截取几个标题字符做以查询的条件。{maccms:vod num="1" wd="'.$wd.'" order="desc" not="'.$obj['vod_id'].'" letter="'.$obj['vod_letter'].'"}
<!--查询同名视频-->
{php}$wd = mac_substring($obj['vod_name'],2);$area='';{/php}
{if condition="is_numeric($wd) eq true"}{php}$wd = mac_substring($obj['vod_name'],4);{/php}{/if}
{if condition="$obj.type_id eq 3 || $obj.type_id eq 4"}{php}$area = $obj['vod_area'];{/php}{/if}
{maccms:vod num="1" wd="'.$wd.'" order="desc" not="'.$obj['vod_id'].'" letter="'.$obj['vod_letter'].'"}
<!--循环内容-->
{:mac_url_vod_detail($vo)}
{$vo.vod_name}
{:mac_url_img($vo.vod_pic)}
{$vo.vod_score}
{if condition="$vo.vod_remarks neq ''"}{$vo.vod_remarks}{elseif condition="$vo.vod_serial gt 0"}第{$vo.vod_serial}集{else /}高清{/if}
主演:{$vo.vod_actor|mac_default='内详'}
{/maccms:vod}
{php}$num = intval(10-$key);{/php}
<!--补充查询-->
{maccms:vod num="'.$num.'" type="current" area="'.$area.'" order="desc" by="time" not="'.$obj['vod_id'].','.$vo['vod_id'].'"}
<!--循环内容-->
{:mac_url_vod_detail($vo)}
{$vo.vod_name}
{:mac_url_img($vo.vod_pic)}
{$vo.vod_score}
{if condition="$vo.vod_remarks neq ''"}{$vo.vod_remarks}{elseif condition="$vo.vod_serial gt 0"}第{$vo.vod_serial}集{else /}高清{/if}
主演:{$vo.vod_actor|mac_default='内详'}
{/maccms:vod}
相关联的:{maccms:vod num="10" tag="'.$wd.'" order="desc" by="time" not="'.$obj['vod_id'].'" type="current" area="'.$area.'"}
<ul id="rel" class="myui-vodlist__bd tab-pane fade in clearfix">
{maccms:vod num="10" tag="'.$wd.'" order="desc" by="time" not="'.$obj['vod_id'].'" type="current" area="'.$area.'"}
<li class="col-lg-5 col-md-6 col-sm-4 col-xs-3{if condition="$key gt 8"} hidden-sm{/if}{if condition="$key gt 9"} hidden-xs{/if}">
<div class="myui-vodlist__box">
<a class="myui-vodlist__thumb" href="{:mac_url_vod_detail($vo)}" title="{$vo.vod_name}" style="background: url({:mac_url_img($vo.vod_pic)});">
<span class="play hidden-xs"></span>
<span class="pic-tag pic-tag-top" style="background-color: #5bb7fe;">{$vo.vod_score}分</span>
<span class="pic-text text-right">{if condition="$vo.vod_remarks neq ''"}{$vo.vod_remarks}{elseif condition="$vo.vod_serial gt 0"}第{$vo.vod_serial}集{else /}高清{/if}</span> </a>
<div class="myui-vodlist__detail">
<h4 class="title text-overflow"><a href="{:mac_url_vod_detail($vo)}" title="{$vo.vod_name}">{$vo.vod_name}</a></h4>
<p class="text text-overflow text-muted hidden-xs">主演:{$vo.vod_actor|mac_default='内详'}</p> </div>
</div>
</li>
{/maccms:vod}
<!--下面是另一个补充查询了,可删-->
{php}$num = intval(10-$key);{/php}
{if condition="$num neq 0"}
{maccms:vod num="'.$num.'" wd="'.$wd.'" order="desc" by="time" not="'.$obj['vod_id'].'" type="current" area="'.$area.'"}
<li class="col-lg-5 col-md-6 col-sm-4 col-xs-3{if condition="$key egt $num-1"} hidden-sm{/if}{if condition="$key egt $num"} hidden-xs{/if}">
<div class="myui-vodlist__box">
<a class="myui-vodlist__thumb" href="{:mac_url_vod_detail($vo)}" title="{$vo.vod_name}" style="background: url({:mac_url_img($vo.vod_pic)});">
<span class="play hidden-xs"></span>
<span class="pic-tag pic-tag-top" style="background-color: #5bb7fe;">{$vo.vod_score}分</span>
<span class="pic-text text-right">{if condition="$vo.vod_remarks neq ''"}{$vo.vod_remarks}{elseif condition="$vo.vod_serial gt 0"}第{$vo.vod_serial}集{else /}高清{/if}</span> </a>
<div class="myui-vodlist__detail">
<h4 class="title text-overflow"><a href="{:mac_url_vod_detail($vo)}" title="{$vo.vod_name}">{$vo.vod_name}</a></h4>
<p class="text text-overflow text-muted hidden-xs">主演:{$vo.vod_actor|mac_default='内详'}</p> </div>
</div>
</li>
{/maccms:vod}{/if}
</ul>