Mercurial > SimpleWebPresenter
diff 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 |
line wrap: on
line diff
--- a/sitemap.php Tue Oct 09 20:15:20 2012 +0200 +++ b/sitemap.php Thu Oct 11 00:48:46 2012 +0200 @@ -1,16 +1,19 @@ <? -header('Content-type: application/xml'); -print '<?xml version="1.0" encoding="UTF-8"?>'; -print "\n"; -?> -<urlset +$out = '<?xml version="1.0" encoding="UTF-8"?>'; +$out .= "\n"; +$out .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" 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"> -<? +'; include_once 'CacheTimeCheck.inc'; +$baseDir = dirname(__FILE__); +$cache = CacheTimeCheck::instance(__FILE__); +$cache->includeOnce('common-functions.inc', $baseDir); + + $cache = CacheTimeCheck::instance(__FILE__); $cache->includeOnce('Options.inc', dirname(__FILE__)); @@ -59,10 +62,10 @@ $lastmod = strtotime($lastmod); $lastmod = date(DateTime::W3C, $lastmod); - print "<url>\n"; - print "<loc>${location}</loc>\n"; - print "<lastmod>${lastmod}</lastmod>\n"; - print "</url>\n"; + $out .= "<url>\n"; + $out .= "<loc>${location}</loc>\n"; + $out .= "<lastmod>${lastmod}</lastmod>\n"; + $out .= "</url>\n"; } } } @@ -71,5 +74,8 @@ } } -?> -</urlset> \ No newline at end of file +$out .= '</urlset>'; + +header('Content-type: application/xml'); +print $out; +?> \ No newline at end of file
