PHP code example of dpn / xml-sitemap-bundle
1. Go to this page and download the library: Download dpn/xml-sitemap-bundle library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
dpn / xml-sitemap-bundle example snippets
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new Dpn\XmlSitemapBundle\DpnXmlSitemapBundle(),
);
}
use Dpn\XmlSitemapBundle\Sitemap\Entry;
use Dpn\XmlSitemapBundle\Sitemap\GeneratorInterface;
class MySitemapGenerator implements GeneratorInterface
{
public function generate()
{
$entries = array();
$entries[] = new Entry('http://example.com/foobar'); // must be absolute URL
// add more entries - perhaps fetched from database
return $entries;
}
}