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

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

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

代码如下

  1. {php}$data_lista = array();$data_list = array();{/php}
  2. {maccms:vod num=40 type=“all” order=desc by=“time”}
  3. {php}
  4. $data_lista[$vo[‘vod_id’]] = strval($vo[‘vod_id’]);
  5. {/php}
  6. {/maccms:vod}
  7. {php}
  8. shuffle($data_lista);
  9. $data_listb = join(“,”,$data_lista );
  10. dump($data_listb);
  11. {/php}
  12. {maccms:vod num=40 type=“all” order=desc by=“time” }
  13. {php}
  14. //dump($vo);
  15. $data_list[$vo[‘vod_time’]][‘vid’] = $vo[‘vod_id’];
  16. $data_list[$vo[‘vod_time’]][‘type’] = $vo[‘type_id’];
  17. $data_list[$vo[‘vod_time’]][‘title’] = $vo[‘vod_name’];
  18. $data_list[$vo[‘vod_time’]][‘pic’] = $vo[‘vod_pic’];
  19. $data_list[$vo[‘vod_time’]][‘content’] = mb_substr(trim($vo[‘vod_blurb’],PHP_EOL) ,0 , 100);
  20. $data_list[$vo[‘vod_time’]][‘time’] = $vo[‘vod_time’];
  21. $data_list[$vo[‘vod_time’]][‘hits’] = $vo[‘vod_hits’];
  22. $data_list[$vo[‘vod_time’]][‘class’] = $vo[‘vod_class’];
  23. {/php}
  24. {/maccms:vod}
  25. {maccms:art num=40 type=“all” order=desc by=“time” }
  26. {php}
  27. //dump($vo);
  28. $data_list[$vo[‘art_time’]][‘aid’] = $vo[‘art_id’];
  29. $data_list[$vo[‘art_time’]][‘type’] = $vo[‘type_id’];
  30. $data_list[$vo[‘art_time’]][‘title’] = $vo[‘art_name’];
  31. $data_list[$vo[‘art_time’]][‘pic’] = $vo[‘art_pic’];
  32. $data_list[$vo[‘art_time’]][‘content’] = mb_substr(trim(htmlspecialchars($vo[‘art_blurb’]), PHP_EOL ) ,0 , 50);
  33. $data_list[$vo[‘art_time’]][‘time’] = $vo[‘art_time’];
  34. $data_list[$vo[‘art_time’]][‘hits’] = $vo[‘art_hits’];
  35. $data_list[$vo[‘art_time’]][‘class’] = $vo[‘art_class’];
  36. {/php}
  37. {/maccms:art}
  38. {php}
  39. krsort($data_list);
  40. dump($data_list);
  41. {/php}
  42. {volist name=“data_list” id=“vo” key=“key” length=40}
  43. {if condition=$vo[‘vid’]”}
  44. {$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}
  45. {else /}
  46. {$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}
  47. {/if}
  48. {/volist}

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

本站出售的源码只允许用于合法用途,以及学习交流技术层面,凡是用于非法用途的与本站无关,本人不承担任何责任!未经本站允许不得转载、倒卖克胡网络 » 苹果maccms把电影视频和文章通过数组结合输出,按最新时间排序
分享到:
赞(0)

评论抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
Hello,欢迎来咨询~