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

作者 : 叶 落风前 本文共4451个字,预计阅读时间需要12分钟 发布时间: 2020-06-8 共59人阅读

打开织梦/include/extend.func.php 最后加上以下代码:

001
//列表页获取网友热搜 24小时
002
function GetHotSearch($tid){
003
global $dsql;
004
$time = time() - 86400;
005
$sql = "select * from dede_archives where typeid = '$tid' and shorttitle <> '' group by shorttitle order by pubdate desc limit 10";
006
$dsql->Execute('me',$sql);
007
$li = '';
008
while($arr = $dsql->GetArray('me'))
009
{
010
if($arr['pubdate'] >$time ){
011
$class = 'new';
012
}else{
013
$class = '';
014
}
015
$barr = GetOneArchive($arr['id']);
016
$arcurl = $barr['arcurl'];
017
$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>';
018
}
019
return $li;
020
}
021
//排行榜获取网友热搜 3天
022
function hot_3_GetHotSearch($tid){
023
global $dsql;
024
$time = time() - 86400;
025
$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";
026
$dsql->Execute('me',$sql);
027
$li = '';
028
while($arr = $dsql->GetArray('me'))
029
{
030
if($arr['pubdate'] >$time ){
031
$class = 'new';
032
}else{
033
$class = '';
034
}
035
$barr = GetOneArchive($arr['id']);
036
$arcurl = $barr['arcurl'];
037
$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>';
038
}
039
return $li;
040
}
041
//排行榜获取网友热搜 7天
042
function hot_7_GetHotSearch($tid){
043
global $dsql;
044
$time = time() - 86400;
045
$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";
046
$dsql->Execute('me',$sql);
047
$li = '';
048
while($arr = $dsql->GetArray('me'))
049
{
050
if($arr['pubdate'] >$time ){
051
$class = 'new';
052
}else{
053
$class = '';
054
}
055
$barr = GetOneArchive($arr['id']);
056
$arcurl = $barr['arcurl'];
057
$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>';
058
}
059
return $li;
060
}
061
//排行榜获取网友热搜 30天
062
function hot_30_GetHotSearch($tid){
063
global $dsql;
064
$time = time() - 86400;
065
$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";
066
$dsql->Execute('me',$sql);
067
$li = '';
068
while($arr = $dsql->GetArray('me'))
069
{
070
if($arr['pubdate'] >$time ){
071
$class = 'new';
072
}else{
073
$class = '';
074
}
075
$barr = GetOneArchive($arr['id']);
076
$arcurl = $barr['arcurl'];
077
$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>';
078
}
079
return $li;
080
}
081
//列表页获取栏目关注 30天 14条
082
function hotword_30_GetHotSearch($tid){
083
global $dsql;
084
$time = time() - 86400;
085
$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";
086
$dsql->Execute('me',$sql);
087
$li = '';
088
while($arr = $dsql->GetArray('me'))
089
{
090
if($arr['pubdate'] >$time ){
091
$class = 'new';
092
}else{
093
$class = '';
094
}
095
$barr = GetOneArchive($arr['id']);
096
$arcurl = $barr['arcurl'];
097
$li .= '<a rel="nofollow" target="_blank" href="go.php?url='.$arcurl.'" title="'.$arr['shorttitle'].'">'.$arr['shorttitle'].'</a>';
098
}
099
return $li;
100
}

 

 

调用方法:

 

1
{dede:field.id function=GetHotSearch(@me)/}

完整源码网ym0.cc,专业提供制网站源码,网站模板,源码下载,商业源码,游戏源码,找源码就到完整源码网 免责声明:本站所提供的资源来自于网络,版权争议与本站无关,版权归原创者所有! 仅限用于学习和研究目的,不得将上述内容资源用于商业或者非法用途. 否则,一切后果请用户自负。您必须在下载后的24个小时之内,从您的电脑中彻底删除上述内容资源。如果上述内容资对您的版权或者利益造成损害,请提供相应的资质证明,我们将于3个工作日内予以删除。 本站不保证所提供下载的资源的准确性、安全性和完整性,源码仅供下载学习之用! 如用于商业或者非法用途,与本站无关,一切后果请用户自负! 本站也不承担用户因使用这些下载资源对自己和他人造成任何形式的损失或伤害。 如有侵权、不妥之处,请联系站长以便删除。 敬请谅解!侵权/投稿邮箱:157529987@qq.com!
完整源码网-ym0.cc » 织梦列表页获取热搜排行榜文章_

常见问题FAQ

开通VIP的好处?
VIP会员根据等级在相应的有效期内享有本站所有资源免费下载资源的权力,免费查看隐藏内容的权力,免费查看视频的权力,同时本站商品还会获得打折价格,并且拥有其他特殊的权力。
完整源码支持最新版本吗?
完整源码网支持永久更新!

发表评论