ADD articles to the sitemap

This commit is contained in:
Krivchikov Dmitry 2015-07-18 14:43:54 +03:00
parent dc03affbb2
commit 1716200d9d
1 changed files with 10 additions and 1 deletions

View File

@ -155,8 +155,17 @@ class IndexController extends Controller
{
$xml = new SimpleXMLElement('<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"/>');
$points = Point::model()->getAll(array('order' => 'ID DESC', 'asArray' => true));
$articles = Article::model()->getAll(array('order' => 'ID DESC', 'asArray' => true));
foreach ($articles as $article)
{
$url = $xml->addChild('url');
$url->addChild('loc', 'http://wikipoints.ru/page/article/id/' . $article['id']);
$url->addChild('lastmod', date("Y-m-d", strtotime('- 5 days')));
$url->addChild('changefreq', "weekly");
$url->addChild('priority', "0.8");
}
$points = Point::model()->getAll(array('order' => 'ID DESC', 'asArray' => true));
foreach ($points as $point)
{
$url = $xml->addChild('url');