K9 通用版 博客版 主题版 地方门户版 企业版 |   企业(ASP) 分类 使用 分享 疑问 模板 建议 帮助 错误 其他
+新建主题 [Ajax]
填写帐号密码即可完成注册
+新建话题 最新回复排序 最新主题排序 精华帖子

KingCMS V9(K9) 利用TAGS调用相关文章,剔除重复

1Next >

催命判官 发表于:12-01-16 10:28 编辑于:01-16 11:20 [添加收藏] 楼主 [回复] #Top#
催命判官 人气:495 积分:3020 金币:26497
VIP 管理团队
根据当前文章TAGS调用相关文章,其中  group='t2.id' 是剔除重复数据,group 也是可以排序的

{@res.join table1='%s_content_tag_bind' field1='tid' table2='%s_content' field2='id,title,url,date' table3='%s_content_tag_bind' field3='id' on='t2.id=t3.id' where="t2.status=1 and t1.id={$info['id']} and t3.tid=t1.tid and t2.id<>{$info['id']}" group='t2.id desc' number='8'}
{#if(!empty($res))}
<h1 class="title">相关文章</h1>

<div class="right relate">
<ul>
{#foreach($res as $rs)}
<li>
<a href="{DIR}{$rs['url']}">{$rs[title]}</a>
<em>[{$rs[date] date='m-d'}]</em>
</li>
{#endforeach}
</ul>
</div>
{#endif}


感谢  toymen  大S 的帮助
随机阅读

Undefined property: cache::$obj

/www/wwwroot/www.kingcms.com/library/cache.class.php - 71


Fatal error: Call to a member function delete() on a non-object in /www/wwwroot/www.kingcms.com/library/cache.class.php on line 71