class XMLSitemapIndexWriter in XML sitemap 6.2
Same name and namespace in other branches
- 7.2 xmlsitemap.xmlsitemap.inc \XMLSitemapIndexWriter
Hierarchy
- class \XMLSitemapWriter extends \XMLWriter
- class \XMLSitemapIndexWriter
Expanded class hierarchy of XMLSitemapIndexWriter
File
- ./
xmlsitemap.xmlsitemap.inc, line 195 - XML sitemap integration functions for xmlsitemap.module.
View source
class XMLSitemapIndexWriter extends XMLSitemapWriter {
protected $rootElement = 'sitemapindex';
function __construct(stdClass &$sitemap, $page = 'index') {
parent::__construct($sitemap, 'index');
}
public function getRootAttributes() {
$attributes['xmlns'] = 'http://www.sitemaps.org/schemas/sitemap/0.9';
if (variable_get('xmlsitemap_developer_mode', 0)) {
$attributes['xmlns:xsi'] = 'http://www.w3.org/2001/XMLSchema-instance';
$attributes['xsi:schemaLocation'] = 'http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd';
}
return $attributes;
}
public function generateXML() {
$lastmod_format = variable_get('xmlsitemap_lastmod_format', XMLSITEMAP_LASTMOD_MEDIUM);
for ($i = 1; $i <= $this->sitemap->chunks; $i++) {
$element = array(
'loc' => $this
->getSitemapUrl('sitemap.xml', array(
'query' => array(
'page' => $i,
),
)),
// @todo Use the actual lastmod value of the chunk file.
'lastmod' => gmdate($lastmod_format, REQUEST_TIME),
);
$this
->writeSitemapElement('sitemap', $element);
}
}
}