首页 > 教程 >
织梦列表页获取热搜排行榜文章
2023-03-07教程围观次
简介打开织梦/include/extend.func.php最后加上以下代码:001//列表页获取网友热搜24小时002functionGetHotSearch($tid){003global$dsql;004$time=time()-86400;005$sql="select*fromdede_archiveswheretypeid='$tid'andshorttitle''groupbyshort
打开织梦/include/extend.func.php 最后加上以下代码:
001//列表页获取网友热搜 24小时002function GetHotSearch($tid){003global $dsql;004$time = time() - 86400;005$sql = "select * from dede_archives where typeid = '$tid' and short <> '' group by short order by pubdate desc limit 10";006$dsql->Execute('me',$sql);007$li = '';008while($arr = $dsql->GetArray('me'))009{010if($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.'" ="'.$arr['short '].'">'.$arr['short '].'</a></li>';018}019return $li;020}021//排行榜获取网友热搜 3天022function hot_3_GetHotSearch($tid){023global $dsql;024$time = time() - 86400;025$sql = "select * from dede_archives where pubdate > UNIX_TIMESTAMP( CURDATE( ) - INTERVAL 3 day) and typeid = '$tid' and short <> '' group by short order by click desc limit 10";026$dsql->Execute('me',$sql);027$li = '';028while($arr = $dsql->GetArray('me'))029{030if($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.'" ="'.$arr['short '].'">'.$arr['short '].'</a></li>';038}039return $li;040}041//排行榜获取网友热搜 7天042function hot_7_GetHotSearch($tid){043global $dsql;044$time = time() - 86400;045$sql = "select * from dede_archives where pubdate > UNIX_TIMESTAMP( CURDATE( ) - INTERVAL 7 day) and typeid = '$tid' and short <> '' group by short order by click desc limit 10";046$dsql->Execute('me',$sql);047$li = '';048while($arr = $dsql->GetArray('me'))049{050if($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.'" ="'.$arr['short '].'">'.$arr['short '].'</a></li>';058}059return $li;060}061//排行榜获取网友热搜 30天062function hot_30_GetHotSearch($tid){063global $dsql;064$time = time() - 86400;065$sql = "select * from dede_archives where pubdate > UNIX_TIMESTAMP( CURDATE( ) - INTERVAL 30 day) and typeid = '$tid' and short <> '' group by short order by click desc limit 10";066$dsql->Execute('me',$sql);067$li = '';068while($arr = $dsql->GetArray('me'))069{070if($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.'" ="'.$arr['short '].'">'.$arr['short '].'</a></li>';078}079return $li;080}081//列表页获取栏目关注 30天 14条082function hotword_30_GetHotSearch($tid){083global $dsql;084$time = time() - 86400;085$sql = "select * from dede_archives where pubdate > UNIX_TIMESTAMP( CURDATE( ) - INTERVAL 90 day) and typeid = '$tid' and short <> '' group by short order by click desc limit 14";086$dsql->Execute('me',$sql);087$li = '';088while($arr = $dsql->GetArray('me'))089{090if($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.'" ="'.$arr['short '].'">'.$arr['short '].'</a>';098}099return $li;100} |
调用方法:
1{dede:field.id function=GetHotSearch(@me)/} |
下载链接:网站源码/小程序源码/网站模板下载
下载排行
- 最新版去水印小程序源码/基于WordPress的短视频去水印小程序源码
- 某鱼最近卖的很火蓝色版微信去水印小程序源码+接口
- 最新短视频去水印小程序源码/带流量主/外卖CPS系统/批量解析/修改MD5
- 帝国CMS仿管理资源吧资料下载网站模板源码/下载会员+积分付费下载功能自动采集资源网站源码
- 苹果CMS二次元慕乔JOELEO模板/精美UI手机版影视模板
- 最新去水印小程序源码分享/无需后台/对接接口/支持全网去水印功能
- 知识付费小程序源码升级版知识付费变现小程序源码+卡密-独立后台版本
- 最新去水印小程序源码分享/无需后台/对接接口/支持全网去水印功能
- 社群空间站一键发布微信群精品优质社群的搜索和发布平台
- 爱看小说网源码全站带数据打包/ThinkPHP内核小说网站源码