实现方式如下:
首先找到根目录的:portal.php文件
打开后,找到这样一段话:
[代码]php代码:
if(empty($_GET['mod']) || !in_array($_GET['mod'], array('list', 'view', 'comment', 'portalcp', 'topic', 'attachment', 'rss', 'block'))) $_GET['mod'] = 'index';
将其修改为:
[代码]php代码:
if(empty($_GET['mod']) || !in_array($_GET['mod'], array('list', 'view', 'comment', 'portalcp', 'topic', 'attachment', 'rss', 'block', 'sitemap'))) $_GET['mod'] = 'index';
然后进入目录:source/module/portal
找到文件:portal_rss.php
重新复制一份出来,命名为:portal_sitemap.php
打开portal_sitemap.php文件
找到内容:
[代码]php代码:
echo "n". "
n". " n". (count($catarray) > 1 ? " { n". " {
$_G[setting][bbname]}
$_G[siteurl]}
forum.phpn". "Latest $num articles of all categories n" : "{ n". " {
$_G[setting][bbname]}
- $catname
$_G[siteurl]}
portal.php?mod=list&catid=$rsscatidn". "Latest $num articles of $catname n" ). "Copyright(C) { n". "
$_G[setting][bbname]}Discuz! Board by Comsenz Inc. n". "".gmdate('r', TIMESTAMP)." n". "$ttl n". "n". " n";{ n". "
$_G[siteurl]}
static/image/common/logo_88_31.gif{ n". " {
$_G[setting][bbname]}
$_G[siteurl]}
n". "
将其修改为:
[代码]php代码:
echo "n". "
n";
找到内容:
[代码]php代码:
echo "
- n". "
n";".$article['subject']." n". " $_G[siteurl]".($rewriteflag ? rewriteoutput('portal_article', 1, '', $article[aid]) : "portal.php?mod=view&aid=$article[aid]")."n". "n". " ".dhtmlspecialchars($article['catname'])." n". " ".dhtmlspecialchars($article['author'])."n". ($attachfile ? ''."n" : ''). " ".gmdate('r', $article['dateline'])." n". "
将其修改为:
[代码]php代码:
echo "
n". " n";$_G[siteurl]".($rewriteflag ? rewriteoutput('portal_article', 1, '', $article[aid]) : "portal.php?mod=view&aid=$article[aid]")." n". "".date('Y-m-d', $article['dateline'])." n". "daily n". "1.0 n". "
找到内容:
[代码]php代码:
echo " n". "";
将其修改为:
[代码]php代码:
echo " n";
然后访问地址:http://www.php2.cc/portal.php?mod=sitemap
即可看到效果,百度sitemap提交这个地址即可。
注意显示条数,可以修改portal_sitemap.php这里:$num = 20; 程序默认是显示20条,可根据自己的需要更改。