苹果maccms把电影视频和文章通过数组结合输出,按最新时间排序

【苹果CMS V10】整合文章视频输出,可用于一些数据流的输出

分别循环输出视频和文章,然后把两者的数据结合起来归类为新的数组,然后通过数组按时间顺序输出内容

代码如下

{php}$data_lista = array();$data_list = array();{/php}
{maccms:vod num="40"  type="all" order="desc" by="time"}
{php}
 $data_lista[$vo['vod_id']] = strval($vo['vod_id']);
{/php}
{/maccms:vod}
{php}
 shuffle($data_lista);
 $data_listb = join(",",$data_lista );
 dump($data_listb);
{/php}
  
{maccms:vod num="40" type="all" order="desc" by="time" }
{php}
  //dump($vo);
  $data_list[$vo['vod_time']]['vid'] = $vo['vod_id'];
  $data_list[$vo['vod_time']]['type'] = $vo['type_id'];
  $data_list[$vo['vod_time']]['title'] = $vo['vod_name'];
  $data_list[$vo['vod_time']]['pic'] = $vo['vod_pic'];
  $data_list[$vo['vod_time']]['content'] = mb_substr(trim($vo['vod_blurb'],PHP_EOL) ,0 , 100);
  $data_list[$vo['vod_time']]['time'] = $vo['vod_time'];
  $data_list[$vo['vod_time']]['hits'] = $vo['vod_hits'];
  $data_list[$vo['vod_time']]['class'] = $vo['vod_class']; 
{/php}
{/maccms:vod}
{maccms:art num="40"  type="all" order="desc" by="time" }
{php}
  //dump($vo);
  $data_list[$vo['art_time']]['aid'] = $vo['art_id'];
  $data_list[$vo['art_time']]['type'] = $vo['type_id'];
  $data_list[$vo['art_time']]['title'] = $vo['art_name'];
  $data_list[$vo['art_time']]['pic'] = $vo['art_pic'];
  $data_list[$vo['art_time']]['content'] = mb_substr(trim(htmlspecialchars($vo['art_blurb']), PHP_EOL ) ,0 , 50);
  $data_list[$vo['art_time']]['time'] = $vo['art_time'];
  $data_list[$vo['art_time']]['hits'] = $vo['art_hits'];
  $data_list[$vo['art_time']]['class'] = $vo['art_class'];
{/php}
{/maccms:art}
{php}
krsort($data_list);
dump($data_list);  
{/php}
{volist name="data_list" id="vo" key="key" length='40'}
                        {if condition="$vo['vid']"}
{$vo.title}{$vo.content|mac_filter_html|mac_substring=100}{$vo.aid|mac_url='art/detail',[],['art_id'=>###]}" >{$vo.pic}{$vo.class}{$vo.hits}{$vo.time|mac_friend_date}
                        {else /}
{$vo.title}{$vo.content|mac_filter_html|mac_substring=100}{$vo.aid|mac_url='art/detail',[],['art_id'=>###]}" >{$vo.pic}{$vo.class}{$vo.hits}{$vo.time|mac_friend_date}
                        {/if}
{/volist}

苹果maccms把电影视频和文章通过数组结合输出,按最新时间排序

参考文章:https://www.h2sheji.com/art/60.html

文章由官网发布,如若转载,请注明出处:https://www.veimoz.com/531
0 评论
4.9k

发表评论

!