所有分类
  • 所有分类
  • 网站模板
  • 设计素材
  • 办公素材
  • 站长素材
  • 软件资源

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

打开织梦/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>';
038
}
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)/}

织梦cms

感谢您阅读这篇织梦列表页获取热搜排行榜文章_织梦网站首页文章文章,希望可以帮助您解决使用织梦cms途中的问题,更多相关织梦cms教程关注我们万条网吧。

文章原文链接:https://www.wantiao.net/35730.html,转载请注明出处。
免责声明:本站资源均来自互联网,仅供研究学习使用,禁止违法违规使用,产生法律纠纷本站概不负责!本站信息来源于网络,版权争议与本站无关。如有侵权请邮件与我们联系处理,敬请谅解!
0

评论0

请先

疫情期间优惠活动!原360元包年VIP,现128元;原588元终身VIP,现158元。随着资源不断增多,随时提价!立即查看
显示验证码
没有账号?注册  忘记密码?

社交账号快速登录