各类知识收集,PHP技术分享与解决方案各类知识收集,PHP技术分享与解决方案各类知识收集,PHP技术分享与解决方案

Str Tom,为分享PHP技术和解决方案,贡献一份自己的力量!
收藏本站(不迷路),每天更新好文章!
当前位置:首页 > CMS教程 > dedecms

织梦列表页获取热搜排行榜文章

管理员 2020-04-11
dedecms
127
打开织梦/include/extend.func.php 最后加上以下代码:
//列表页获取网友热搜 24小时function GetHotSearch($tid){global $dsql;$time = time() - 86400;$sql = "select * from dede_archives where typeid = '$tid' and shorttitle <> '' group by shorttitle order by pubdate desc limit 10";$dsql->Execute('me',$sql);$li = '';while($arr = $dsql->GetArray('me')){if($arr['pubdate'] >$time ){$class = 'new';}else{$class = '';}$barr = GetOneArchive($arr['id']);$arcurl = $barr['arcurl'];$li .= '<li><span class="right"><time class="'.$class.'">'.date('Y-m-d',$arr['pubdate']).'</time></span><a rel="nofollow" target="_blank" href="go.php?url='.$arcurl.'" title="'.$arr['shorttitle'].'">'.$arr['shorttitle'].'</a></li>';}return $li;}//排行榜获取网友热搜 3天function hot_3_GetHotSearch($tid){global $dsql;$time = time() - 86400;$sql = "select * from dede_archives where pubdate > UNIX_TIMESTAMP( CURDATE( ) - INTERVAL 3 day) and typeid = '$tid' and shorttitle <> '' group by shorttitle order by click desc limit 10";$dsql->Execute('me',$sql);$li = '';while($arr = $dsql->GetArray('me')){if($arr['pubdate'] >$time ){$class = 'new';}else{$class = '';}$barr = GetOneArchive($arr['id']);$arcurl = $barr['arcurl'];$li .= '<li><span class="right"><time class="'.$class.'">'.date('Y-m-d',$arr['pubdate']).'</time></span><a rel="nofollow" target="_blank" href="go.php?url='.$arcurl.'" title="'.$arr['shorttitle'].'">'.$arr['shorttitle'].'</a></li>';}return $li;}//排行榜获取网友热搜 7天function hot_7_GetHotSearch($tid){global $dsql;$time = time() - 86400;$sql = "select * from dede_archives where pubdate > UNIX_TIMESTAMP( CURDATE( ) - INTERVAL 7 day) and typeid = '$tid' and shorttitle <> '' group by shorttitle order by click desc limit 10";$dsql->Execute('me',$sql);$li = '';while($arr = $dsql->GetArray('me')){if($arr['pubdate'] >$time ){$class = 'new';}else{$class = '';}$barr = GetOneArchive($arr['id']);$arcurl = $barr['arcurl'];$li .= '<li><span class="right"><time class="'.$class.'">'.date('Y-m-d',$arr['pubdate']).'</time></span><a rel="nofollow" target="_blank" href="go.php?url='.$arcurl.'" title="'.$arr['shorttitle'].'">'.$arr['shorttitle'].'</a></li>';}return $li;}//排行榜获取网友热搜 30天function hot_30_GetHotSearch($tid){global $dsql;$time = time() - 86400;$sql = "select * from dede_archives where pubdate > UNIX_TIMESTAMP( CURDATE( ) - INTERVAL 30 day) and typeid = '$tid' and shorttitle <> '' group by shorttitle order by click desc limit 10";$dsql->Execute('me',$sql);$li = '';while($arr = $dsql->GetArray('me')){if($arr['pubdate'] >$time ){$class = 'new';}else{$class = '';}$barr = GetOneArchive($arr['id']);$arcurl = $barr['arcurl'];$li .= '<li><span class="right"><time class="'.$class.'">'.date('Y-m-d',$arr['pubdate']).'</time></span><a rel="nofollow" target="_blank" href="go.php?url='.$arcurl.'" title="'.$arr['shorttitle'].'">'.$arr['shorttitle'].'</a></li>';}return $li;}//列表页获取栏目关注 30天 14条function hotword_30_GetHotSearch($tid){global $dsql;$time = time() - 86400;$sql = "select * from dede_archives where pubdate > UNIX_TIMESTAMP( CURDATE( ) - INTERVAL 90 day) and typeid = '$tid' and shorttitle <> '' group by shorttitle order by click desc limit 14";$dsql->Execute('me',$sql);$li = '';while($arr = $dsql->GetArray('me')){if($arr['pubdate'] >$time ){$class = 'new';}else{$class = '';}$barr = GetOneArchive($arr['id']);$arcurl = $barr['arcurl'];$li .= '<a rel="nofollow" target="_blank" href="go.php?url='.$arcurl.'" title="'.$arr['shorttitle'].'">'.$arr['shorttitle'].'</a>';}return $li;}
    调用方法:  
{dede:field.id function=GetHotSearch(@me)/}

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关推荐

扫码关注

qrcode

QQ交谈

回顶部