comparison sitemap.php @ 52:3898353ed1d8

Include fixes. sitemap don't print before everything has been processed. Make a class of accept-language.
author Tom Fredrik "BFG" Klaussen <bfg@blenning.no>
date Thu, 11 Oct 2012 00:48:46 +0200
parents 79f708a48a7c
children 2e6ba7259281
comparison
equal deleted inserted replaced
50:2d0cda52f43f 52:3898353ed1d8
1 <? 1 <?
2 header('Content-type: application/xml'); 2 $out = '<?xml version="1.0" encoding="UTF-8"?>';
3 print '<?xml version="1.0" encoding="UTF-8"?>'; 3 $out .= "\n";
4 print "\n"; 4 $out .= '<urlset
5 ?>
6 <urlset
7 xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" 5 xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
8 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 6 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9 xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 7 xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
10 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"> 8 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
11 <? 9 ';
12 include_once 'CacheTimeCheck.inc'; 10 include_once 'CacheTimeCheck.inc';
11
12 $baseDir = dirname(__FILE__);
13 $cache = CacheTimeCheck::instance(__FILE__);
14 $cache->includeOnce('common-functions.inc', $baseDir);
15
13 16
14 $cache = CacheTimeCheck::instance(__FILE__); 17 $cache = CacheTimeCheck::instance(__FILE__);
15 $cache->includeOnce('Options.inc', dirname(__FILE__)); 18 $cache->includeOnce('Options.inc', dirname(__FILE__));
16 19
17 $master = new DOMDocument(); 20 $master = new DOMDocument();
57 60
58 $lastmod = $headers["Last-Modified"]; 61 $lastmod = $headers["Last-Modified"];
59 $lastmod = strtotime($lastmod); 62 $lastmod = strtotime($lastmod);
60 $lastmod = date(DateTime::W3C, $lastmod); 63 $lastmod = date(DateTime::W3C, $lastmod);
61 64
62 print "<url>\n"; 65 $out .= "<url>\n";
63 print "<loc>${location}</loc>\n"; 66 $out .= "<loc>${location}</loc>\n";
64 print "<lastmod>${lastmod}</lastmod>\n"; 67 $out .= "<lastmod>${lastmod}</lastmod>\n";
65 print "</url>\n"; 68 $out .= "</url>\n";
66 } 69 }
67 } 70 }
68 } 71 }
69 } 72 }
70 closedir($handle); 73 closedir($handle);
71 } 74 }
72 } 75 }
73 76
77 $out .= '</urlset>';
78
79 header('Content-type: application/xml');
80 print $out;
74 ?> 81 ?>
75 </urlset>