织梦列表页获取热搜排行榜文章
打开织梦/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)/}
☉本站的源码不会像其它下载站一样植入大量的广告。为了更好的用户体验以后坚持不打水印
☉本站只提供精品源码,源码在于可用,不在多!!希望在这里找到你合适的。
☉本站提供的整站程序,均带数据及演示地址。可以在任一源码详情页查看演示地址
☉本站所有资源(包括源码、模板、素材、特效等)仅供学习与参考,请勿用于商业用途。
☉如有其他问题,请加网站客服QQ(984818011)进行交流。
- 织梦dede首页列表页获取文章对应的tag标签
- 织梦dede导航栏目顶级和二级判断二级输出不同url
- 织梦dede标签array runphp静态生成乱码BUG解决方法
- 织梦dede如何禁止会员发布文章内容带超链接
- 织梦ajax跨域提交自定义表单和跨域验证码问题
- 织梦CMS MIP文章内容页图片适配百度MIP规范
- 织梦CMS时间格式实现XX秒前、XX分钟前、XX天前
- 织梦DedeCMS更新系统缓存增加清理沉余缓存的功能
- 织梦CMS让channelartlist标签支持currentstyle属性的
- 织梦dede自带编辑器替换百度ueditor编辑器
- 织梦DEDECMS整站动态化或整站静态化设置方法
- 织梦dede 模板路径templets目录都有什么?