JTBC(CMS)

开源与免费的跨平台网站内容管理系统解决方案

首页 » 在线论坛 » PHP版本 
帖子内容
1 楼
nilcay
注册会员
积分 360
注册 2008-10-27
     
Google Sitemap 自动生成解决方案 二
以前发过一个方案,但更新后要手动生成(按扭),更适合数据较多时用。现在这个是用伪静态的思路做的,用起来更方便,就像你改模版一样,并且适用于所有版本的JTBC。已通过Google测试,能正常使用。这个不适合数据量较大的站使用!


步骤 一


还是选建调用模板:


[color=#333333]    <item>
      <name><![CDATA[sitemap]]></name>
      <tpl_default><![CDATA[{@}
<url>
<loc>http://seeble.cn/{$=ii_curl('{$baseurl}', ii_iurl('detail', {$id}, {$urltype}, 'folder={$createfolder};filetype={$createfiletype};time={$time}'))}</loc>
<lastmod>{$=ii_format_date('{$time}',1)}T00:01:00+08:00</lastmod>
<changefreq>weekly</changefreq>
<priority>0.8</priority>
</url>{@}]]></tpl_default>
    </item>


如果你有论坛,可以再添加个:


    <item>
      <name><![CDATA[sitemap_forum]]></name>
      <tpl_default><![CDATA[{@}
<url>
<loc>http://seeble.cn/{$baseurl}?type=detail&amp;sid={$sid}&amp;tid={$id}</loc>
<lastmod>{$=ii_format_date('{$time}',1)}T00:01:00+08:00</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>{@}]]></tpl_default>
    </item>


步骤 二


common/incfiles/module_config.inc.php 进行修改,用以下代码代替原来的:


<?php
function jtb_cms_module_index()
{
  $tmpstr = ii_ireplace('module.index', 'tpl');
  return $tmpstr;
}


function jtb_cms_module_sitemap()
{
  $tmpstr = ii_ireplace('module.sitemap', 'tpl');
  return $tmpstr;
}


function jtb_cms_module()
{
  switch($_GET['type'])
  {
    case 'sitemap.xml':
      return jtb_cms_module_sitemap();
      break;
    case 'index':
      return jtb_cms_module_index();
      break;
    default:
      return jtb_cms_module_index();
      break;
  }
}
?>



步骤 三


[b]在网站首页的模板中添加一个新节点,内容如下:


    <item>
      <name><![CDATA[sitemap]]></name>
      <tpl_default><![CDATA[<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">{$=vv_itransfer('top', 'sitemap', 'topx=10000;genre=article)}
</urlset>]]></tpl_default>
    </item>


注意要把网址改成你自己的!


现在向Google提交就可以了,地址是:


http://seeble.cn/?type=sitemap.xml
[/b]

[/color]
2010-02-02 21:19:50 去我的世界看看:www.seeble.cn
2 楼
laohou
注册会员
积分 22
注册 2009-12-11
     
回复: Google Sitemap 自动生成解决方案 二
先谢谢了。找时间试一下。
2010-02-03 00:10:57
回复帖子
发表人
主题
内容
验证码