<?php $tag_content = D('tag_content'); //如果是下载模型的相关文章内容,这个地方就要改为下载模型ID $res = $tag_content->field('tagid')->where(array('modelid'=>1,'aid'=>$id))->limit(10)->select(); if(!empty($res)){ $tagid = array(); foreach($res as $val){ $tagid[] = $val['tagid']; } //下载 $lmid=get_category(相关下载栏目ID, 'arrchildid'); $res = $tag_content->field('aid')->where('modelid=3 AND catid IN ('.$lmid.') AND tagid IN ('.implode(',', $tagid).')')->group('aid')->limit(16)->order('aid DESC')->select(); $ids = array(); foreach($res as $val){ //如果是下载模型下的 相关文章内容,则要添加上这句。 //去除当前的内容ID //if($val['aid'] == $id) continue; $ids[] = $val['aid']; } if(!empty($ids)){ $xg1 = D('download')->field('title,thumb,url,version,filesize,stars')->where('status=1 AND id IN ('.implode(',', $ids).')')->order('id DESC')->limit(15)->select(); } //文章 $lmid2=get_category(相关文章栏目ID, 'arrchildid'); $res1 = $tag_content->field('aid')->where('modelid=1 AND catid IN ('.$lmid2.') AND tagid IN ('.implode(',', $tagid).')')->group('aid')->limit(13)->order('aid DESC')->select(); $ids1 = array(); foreach($res1 as $val){ //去除当前的内容ID if($val['aid'] == $id) continue; $ids1[] = $val['aid']; } if(!empty($ids1)){ $xg = D('article')->field('title,url')->where('status=1 AND id IN ('.implode(',', $ids1).')')->order('id DESC')->limit(12)->select(); } } ?> {if isset($xg1)} {loop $xg1 $v} <div class="item"> <a target="_blank" href="{$v[url]}" title="{$v[title]}"><img src="{if !empty($v['thumb'])}{$v[thumb]}{else}{SITE_URL}skin/img/loading-1.gif{/if}" width="96" height="96" alt="{$v[title]}"/></a> <div class="body"> <div class="title"> <a target="_blank" href="{$v[url]}" title="{$v[title]}"> {$v[title]} </a> </div> <div class="row"><span class="s{$v[stars]}"></span></div> <div class="row"> {$v[filesize]} / {$v[version]} </div> </div> </div> {/loop} {/if} {if isset($xg)} {loop $xg $v} <li><i class="dot"></i><a target="_blank" href="{$v[url]}">{$v[title]}</a></li> {/loop} {/if}
在某个文章栏目中列出另一个下载栏目中TAG相关的产品
有问题可以加入织梦技术QQ群一起交流学习
本站vip会员 请加入 VIP②群 PS:加入时备注用户名或昵称
普通注册会员或访客 请加入技术交流②群
作者:54818模板网 关注:423 时间:2019-12-25 22:31:48
相关网站教程: