/mvc/views/sitemap
[return to app]1
<?php
2 $baseUrl = 'http://' . $_SERVER['HTTP_HOST'] . '/';
3 echo '<' . '?xml version="1.0" encoding="UTF-8"?' . '>' . PHP_EOL
4 . '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . PHP_EOL
5 . '<url><loc>' . $baseUrl . '</loc><changefreq>weekly</changefreq></url>' . PHP_EOL;
6 foreach ($urls as $url) {
7 echo '<url><loc>' . $baseUrl . $url . '</loc><changefreq>weekly</changefreq></url>' . PHP_EOL;
8 }
9 echo '</urlset>';