src/Silvestra/Component/Sitemap/Render/XmlRender.php
public function renderSitemap(array $entries)
    {
        $data = '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL;
        $data .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . PHP_EOL;
        foreach ($entries as $entry) {
            $data .= '    <url>' . PHP_EOL;
            $data .= '        <loc>' . $entry->getLoc() . '</loc>' . PHP_EOL;
            if (null !== $entry->getLastMod()) {
                $data .= '        <lastmod>' . $entry->getLastMod() . '</lastmod>' . PHP_EOL;
            }
            if (null !== $entry->getChangeFreq()) {
                $data .= '        <changefreq>' . $entry->getChangeFreq() . '</changefreq>' . PHP_EOL;
            }
            if (null !== $entry->getPriority()) {
                $data .= '        <priority>' . $entry->getPriority() . '</priority>' . PHP_EOL;
            }
            $data .= '    </url>' . PHP_EOL;
        }

        $data .= '</urlset>' . PHP_EOL;

        return $data;
    }
public function renderSitemap(array $entries)
    {
        $data = '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL;
        $data .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . PHP_EOL;
        foreach ($entries as $entry) {
            $data .= '    <url>' . PHP_EOL;
            $data .= '        <loc>' . $entry->getLoc() . '</loc>' . PHP_EOL;
            if (null !== $entry->getLastMod()) {
                $data .= '        <lastmod>' . $entry->getLastMod() . '</lastmod>' . PHP_EOL;
            }
            if (null !== $entry->getChangeFreq()) {
                $data .= '        <changefreq>' . $entry->getChangeFreq() . '</changefreq>' . PHP_EOL;
            }
            if (null !== $entry->getPriority()) {
                $data .= '        <priority>' . $entry->getPriority() . '</priority>' . PHP_EOL;
            }
            $data .= '    </url>' . PHP_EOL;
        }

        $data .= '</urlset>' . PHP_EOL;

        return $data;
    }
public function renderSitemap ( array $ entries ) { $ data = '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL ; $ data .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . PHP_EOL ; foreach ( $ entries as $ entry ) { $ data .= '    <url>' . PHP_EOL ; $ data .= '        <loc>' . $ entry -> getLoc ( ) . '</loc>' . PHP_EOL ; if ( null !== $ entry -> getLastMod ( ) ) { $ data .= '        <lastmod>' . $ entry -> getLastMod ( ) . '</lastmod>' . PHP_EOL ; } if ( null !== $ entry -> getChangeFreq ( ) ) { $ data .= '        <changefreq>' . $ entry -> getChangeFreq ( ) . '</changefreq>' . PHP_EOL ; } if ( null !== $ entry -> getPriority ( ) ) { $ data .= '        <priority>' . $ entry -> getPriority ( ) . '</priority>' . PHP_EOL ; } $ data .= '    </url>' . PHP_EOL ; } $ data .= '</urlset>' . PHP_EOL ; return $ data ; }
Render sitemap xml.

@param array|UrlEntryInterface[] $entries

@return string
Render sitemap xml .