一聚教程网:一个值得你收藏的教程网站

热门教程

discuz x2.5 sitemap每页调取100条最新帖子文章

时间:2022-06-25 16:33:26 编辑:袖梨 来源:一聚教程网

应用中心有不少sitemap之类的插件,有点小贵,嫌麻烦,也许没深刻体会那些插件的用处吧(*^__^*) 嘻嘻
参考网上的方法 discuz x2.5 sitemap每页调取100条最新帖子文章,希望对seo/seo.html" target="_blank">搜索引擎SEO有点帮助咯

具体实现代码

 代码如下 复制代码

define('APPTYPEID', 4);
define('CURSCRIPT', 'sitemap');
require './source/class/class_core.php';
$discuz = & discuz_core::instance();
$discuz->cachelist = $cachelist;$discuz->init();
$navtitle='淘货源-您身边的货源专家';    //淘货源-您身边的货源专家
$metakeywords='淘货源,网店推广,网店货源,网店代理,网店代销,淘宝货源,拍拍货源,货源,开店经验,网店交流学习,直通车,淘宝客,经验交流,找货源,女装货源,男装货源,包包货源,化妆品货源,家纺货源,货源论坛,货源批发,淘我所爱';  //网站关键词
$metadescription='淘货源是专业的网店货源网站,为寻找网店代理、网店代销、一件代发的网友提供专业的货源服务,并提供优质的货源信息;分享网店推广,开店经验交流,就上淘货源'; //网站描述
include template('common/header');

echo '
  

    ';
    $site_num  = DB::result(DB::query("SELECT COUNT(`tid`) FROM ".DB::table('forum_thread')." as a inner join ".DB::table('forum_forum')." as b on a.fid=b.fid where a.displayorder=0 ORDER BY a.tid DESC"));
    $site_num = $site_num ? $site_num :0;
    $site_listnum = 100;
    $site_page = intval($_G['gp_page']) ? intval($_G['gp_page']) :1;
    $site_max = $site_page > 0 ? $site_listnum * ($site_page-1) : 0;
    $site_max2 =   $site_max2 + 100;
    $querys = DB::query("SELECT a.tid,a.subject,a.fid,b.name FROM ".DB::table('forum_thread')." as a inner join ".DB::table('forum_forum')." as b on a.fid=b.fid where a.displayorder=0 ORDER BY a.tid DESC LIMIT ".$site_max.",".$site_max2);
    $multipage = multi($site_num, $site_listnum,$site_page, "sitemap.php");
    $i=1;while($threadfid = DB::fetch($querys)){echo '
  • '.$i.'、['.$threadfid['name'].'] '.$threadfid['subject'].'
  • ';$i++;}
    echo $multipage;
    echo '
';
include template('common/footer');?>

保存sitemap.php,并上传到你空间的根目录下

进入你网站的后台-界面-导航设置-底部导航,添加一个底部链接,链接地址为http://你的地址/sitemap.php,别忘了勾选“可用”

热门栏目