建站之星产品帮助

查看: 1917|回复: 2
打印 上一主题 下一主题

自定义链接模式下百度地图和谷歌地图的严重问题?

[复制链接]
跳转到指定楼层
1#
发表于 2013-9-3 11:06:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
- 规则  P开头的规则  http://ahfd.cn/p-.html
<url>

<loc>http://ahfd.cn/p-.html<;/loc>


<lastmod>2013-07-18</lastmod>


<changefreq>weekly</changefreq>


<priority>0.8</priority>


</url>


- <url>

<loc>http://ahfd.cn/p-.html<;/loc>


<lastmod>2013-08-03</lastmod>


<changefreq>weekly</changefreq>


<priority>0.8</priority>


</url>


- <url>

<loc>http://ahfd.cn/p-.html<;/loc>


<lastmod>2013-08-03</lastmod>


<changefreq>weekly</changefreq>


<priority>0.8</priority>


</url>


- <url>

<loc>http://ahfd.cn/p-.html<;/loc>


<lastmod>2013-08-13</lastmod>


<changefreq>weekly</changefreq>


<priority>0.8</priority>


</url>


- <url>

<loc>http://ahfd.cn/p-.html<;/loc>


<lastmod>2013-08-25</lastmod>


<changefreq>weekly</changefreq>


<priority>0.8</priority>


</url>


- <url>

<loc>http://ahfd.cn/p-.html<;/loc>


<lastmod>2013-08-13</lastmod>


<changefreq>weekly</changefreq>


<priority>0.8</priority>


</url>


- <url>

<loc>http://ahfd.cn/p-.html<;/loc>


<lastmod>2013-08-26</lastmod>


<changefreq>weekly</changefreq>


<priority>0.8</priority>


</url>


- <url>

<loc>http://ahfd.cn/p-.html<;/loc>


<lastmod>2013-08-25</lastmod>


<changefreq>weekly</changefreq>


<priority>0.8</priority>


</url>


- <url>

<loc>http://ahfd.cn/p-.html<;/loc>


<lastmod>2013-08-26</lastmod>


<changefreq>weekly</changefreq>


<priority>0.8</priority>


</url>
2#
 楼主| 发表于 2013-9-3 11:31:49 | 只看该作者
我已经解决了 下载此文件覆盖下就可以了
  1. <?php
  2. if (!defined('IN_CONTEXT')) die('access violation error!');

  3. class ModSitemap extends Module {
  4.         protected $_filters = array(
  5.         //'check_login' => '{show_search}'
  6.     );
  7.    
  8.     public function create_sitemap(){
  9.             $tag = ParamHolder::get('tag','b');
  10.             $url = $_SERVER[HTTP_HOST].$_SERVER['PHP_SELF'];
  11.             $xml = $this->xml_header($tag);
  12.             $xml .= $this->article_map($tag,$url);
  13.             $xml .= $this->prod_map($tag,$url);
  14.             $xml .= $tag=='b'?'</document>':'</urlset>';
  15.             if ($tag=='b') {
  16.                     $fp = fopen(ROOT.'/sitemap_baidu.xml', 'wb');
  17.             }else{
  18.                     $fp = fopen(ROOT.'/sitemap.xml', 'wb');
  19.             }
  20.            
  21.             if (@fwrite($fp, $xml)) {
  22.                     echo 'XML文件生成成功';
  23.             }else{
  24.                     echo 'XML文件生成失败,请检查根目录下是否有写权限';
  25.             }
  26.                 fclose($fp);
  27.             exit;
  28.     }
  29.    
  30.     public function xml_header($tag){
  31.             if ($tag=='b') {
  32.                     $email = SessionHolder::get('user/email');
  33.                     $_site = SessionHolder::get('_SITE');
  34.                     $site_name = $_site->site_name;
  35.                     $xml = '<?xml version="1.0" encoding="UTF-8"?>
  36.                                     <document>
  37.                                     <webSite>'.trim($site_name).'</webSite>
  38.                                     <webMaster>'.trim($email).'</webMaster>
  39.                                     <updatePeri>15</updatePeri>';
  40.             }else{
  41.                     $xml = '<?xml version="1.0" encoding="UTF-8"?>
  42.                                     <urlset xmlns="http://www.google.com/schemas/sitemap/0.84">';
  43.             }
  44.             return $xml;
  45.     }
  46.    
  47.     public function article_map($tag,$url){

  48.             $o_article = new Article();
  49.             $articles = $o_article->findAll();
  50.             foreach ($articles as $article){
  51.                         if(MOD_REWRITE=='2'){
  52.                                 $tmp = 'http://'.str_replace('/index.php','',$url).'/mod_article-article_content-article_id-'.$article->id.'.html';
  53.                         }elseif(MOD_REWRITE=='3'){
  54.                                 $tmp = 'http://'.str_replace('/index.php','',$url).'/a-'.$article->id.'.html';
  55.                         }else{
  56.                                 $tmp = 'http://'.$url.'?_m=mod_article&_a=article_content&article_id='.$article->id;
  57.                         }
  58.                     if ($tag=='g') {
  59.                             $str .= '<url>
  60.                                                     <loc>'.trim($tmp).'</loc>
  61.                                                     <lastmod>'.date('Y-m-d',$article->create_time).'</lastmod>
  62.                                                     <changefreq>weekly</changefreq>
  63.                                                     <priority>0.8</priority>
  64.                                             </url>';
  65.                     }else{
  66.                             $o_category = new ArticleCategory();
  67.                             $category = $o_category->find("id=?",array($article->article_category_id));
  68.                             $cate = $category->name;
  69.                             $str .= '<item>
  70.                                                     <title>'.htmlspecialchars(trim($article->title)).'</title>
  71.                                                     <link>'.trim($tmp).'</link>
  72.                                                     <description>'.htmlspecialchars(trim($article->description)).'</description>
  73.                                                     <text>'.htmlspecialchars(trim($article->intro)).'</text>
  74.                                                     <keywords>'.htmlspecialchars(trim($article->tag)).'</keywords>
  75.                                                     <category>'.htmlspecialchars(trim($cate)).'</category>
  76.                                                     <author>'.trim($article->author).'</author>
  77.                                                     <source>'.trim($article->source).'</source>
  78.                                                     <pubDate>'.date('Y-m-d H:i:s',$article->create_time).'</pubDate>
  79.                                             </item>';
  80.                     }
  81.             }
  82.             return $str;
  83.     }
  84.    
  85.     public function prod_map($tag,$url){
  86.             $o_product = new Product();
  87.             $products = $o_product->findAll();
  88.             foreach ($products as $product){
  89.                         if(MOD_REWRITE=='2'){
  90.                                 $tmp = 'http://'.str_replace('/index.php','',$url).'/mod_product-view-p_id-'.$product->id.'.html';
  91.                                
  92.                         }elseif(MOD_REWRITE=='3'){
  93.                                 $tmp = 'http://'.str_replace('/index.php','',$url).'/p-'.$product->id.'.html';
  94.                         }else{
  95.                                 $tmp = 'http://'.$url.'?_m=mod_product&_a=view&p_id='.$product->id;
  96.                         }
  97.                     if ($tag=='g') {
  98.                             $str .= '<url>
  99.                                                     <loc>'.trim($tmp).'</loc>
  100.                                                     <lastmod>'.date('Y-m-d',$product->create_time).'</lastmod>
  101.                                                     <changefreq>weekly</changefreq>
  102.                                                     <priority>0.8</priority>
  103.                                             </url>';
  104.                     }else{
  105.                             $o_category = new ProductCategory();
  106.                             $category = $o_category->find("id=?",array($product->product_category_id));
  107.                             $cate = $category->name;
  108.                             $str .= '<item>
  109.                                                     <title>'.htmlspecialchars(trim($product->name)).'</title>
  110.                                                     <link>'.trim($tmp).'</link>
  111.                                                     <description>'.htmlspecialchars(trim($product->meta_desc)).'</description>
  112.                                                     <text>'.htmlspecialchars(trim($product->introduction)).'</text>
  113.                                                     <keywords>'.htmlspecialchars(trim($product->meta_key)).'</keywords>
  114.                                                     <category>'.htmlspecialchars(trim($cate)).'</category>
  115.                                                     <pubDate>'.date('Y-m-d H:i:s',$product->create_time).'</pubDate>
  116.                                             </item>';
  117.                     }
  118.             }
  119.             return $str;
  120.            
  121.     }
  122.    
  123. }
  124. ?>
复制代码
3#
发表于 2013-9-3 12:33:13 | 只看该作者
感谢你的反馈

上海美橙科技信息发展有限公司 ( 沪ICP备11006888号-4 )

快速回复 返回顶部 返回列表