Esempio n. 1
0
 static function buildSitemap($config, $items)
 {
     $builder = new SitemapBuilder($config);
     $builder->start();
     $builder->join($items);
     return $builder->commit();
 }
Esempio n. 2
0
<?php

/* This software is released under the BSD license. Full text at project root -> license.txt */
require_once "../../../init.php";
if (isset(Config::instance()->SITEMAP_MODE) && Config::instance()->SITEMAP_MODE == "static") {
    $sitemap_dirs = Config::instance()->SITEMAP_DIRS;
    $sitemap = SitemapBuilder::generate_from_pages($sitemap_dirs);
    $sitemap->render();
}
Esempio n. 3
0
<?php

require_once dirname(__FILE__) . "/../common.inc.php";
set_time_limit(0);
ini_set('memory_limit', '64M');
$dir = dirname(__FILE__);
//document root path
$tmp_dir = dirname(__FILE__);
//temp path
$base_url = 'http://mysite.ru/';
//url with sitemaps (http://mysite.ru/sitemap.xml)
$gzip = true;
$config = array('path' => $dir, 'tmp_dir' => $tmp_dir, 'base_url' => $base_url, 'gzip' => $gzip, 'gzip_level' => 9);
$builder = new SitemapBuilder($config);
$time = time();
$builder->start();
$builder->addUrl(array('loc' => $base_url, 'lastmod' => $time, 'priority' => 1.0, 'changefreq' => 'weekly'));
$builder->addUrl(array('loc' => $base_url . "news", 'lastmod' => $time, 'priority' => 1.0, 'changefreq' => 'weekly'));
/*
//this is example adding url 
$documents = News::find(array('criteria'=>'is_published=1'));
foreach($documents as $document)
  $builder->addUrl(array('loc'=>$document->getUrl(),'lastmod'=>$document->getUtime(),'priority'=>0.8,'changefreq'=>'weekly'))
*/
$builder->commit();