-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsitemap.php
57 lines (51 loc) · 2.06 KB
/
sitemap.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
require_once 'include/common.inc.php';
require_once 'include/sitemap.class.php';
$site_map_container = new google_sitemap();
$siteurl = $tempinfo->get_template_vars('siteurl');
$productlist = $productdata->GetProductList(0);
$articlelist = $articledata->GetArticleList(0);
$productcategory = $categorydata->GetCategoryList(0,"product");
$articlecategory = $categorydata->GetCategoryList(0,"article");
//列出产品
for ( $i=0; $i < count( $productlist ); $i++ )
{
$value = $productlist[ $i ];
$locobj = array("type" => "product","name" => "$value->filename","siteurl" => "$siteurl");
$loc = formaturl($locobj);
$site_map_item = new google_sitemap_item( $loc, date("c"), 'monthly', "0.5" );
$site_map_container->add_item( $site_map_item );
}
//列出文章
for ( $i=0; $i < count( $articlelist ); $i++ )
{
$value = $articlelist[ $i ];
$locobj = array("type" => "article","name" => "$value->filename","siteurl" => "$siteurl");
$loc = formaturl($locobj);
$site_map_item = new google_sitemap_item( $loc, date("c"), 'monthly', "0.5" );
$site_map_container->add_item( $site_map_item );
}
//列出产品分类
for ( $i=0; $i < count( $productcategory ); $i++ )
{
$value = $productcategory[ $i ];
$locobj = array("type" => "category","name" => "$value->filename","siteurl" => "$siteurl");
$loc = formaturl($locobj);
$site_map_item = new google_sitemap_item( $loc, date("c"), 'weekly', "0.8" );
$site_map_container->add_item( $site_map_item );
}
//列出文章分类
for ( $i=0; $i < count( $articlecategory ); $i++ )
{
$value = $articlecategory[ $i ];
$locobj = array("type" => "category","name" => "$value->filename","siteurl" => "$siteurl");
$loc = formaturl($locobj);
$site_map_item = new google_sitemap_item( $loc, date("c"), 'weekly', "0.8" );
$site_map_container->add_item( $site_map_item );
}
//列出首页
$site_map_item = new google_sitemap_item( "$siteurl", date("c"), 'always', "1.0" );
$site_map_container->add_item( $site_map_item );
header( "Content-type: application/xml; charset=\"".$site_map_container->charset . "\"", true );
print $site_map_container->build();
?>