织梦 Dedecms 列表页获取访客热搜排行榜文章的方法,方法比较简单只需要打开织梦/include/extend.func.PHP
最后加上以下代码:
//列表页获取网友热搜 24小时function jjGetHotSearch($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 href="'.$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 href="'.$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 href="'.$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 href="'.$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 href="'.$arcurl.'" Title="'.$arr['shortTitle'].'">'.$arr['shortTitle'].'</a>';}return $li;}
列表调用方法:{dede:fIEld.ID function=jjGetHotSearch(@me)/},其他函数调用方法也是一样的,自己修改下 jjGetHotSearch 名称就可以了 。
总结以上是内存溢出为你收集整理的织梦DedeCMS列表页获取访客热搜排行榜文章的方法全部内容,希望文章能够帮你解决织梦DedeCMS列表页获取访客热搜排行榜文章的方法所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)