Source for file sitemap_example.php
Documentation is available at sitemap_example.php
require_once "File/Sitemap.php";
require_once "File/Sitemap/Index.php";
// Since dom is a protected member, we create
// this little utility class to show an example
// of the generated output.
$this->dom->formatOutput = true;
$sm = $this->dom->saveXML ();
// $sm = new File_Sitemap();
$baseurl = 'http://pear.php.net';
'/manual/en/preface.php',
'/pepr/pepr-proposal-show.php?id=555',
// A function to generate an arbitrary priority number...
// Add urls to our sitemap
foreach ($urls as $url) {
// Add some precisions for specific pages
$sm->add($baseurl. '/', NULL , 'daily');
$sm->add($baseurl. '/manual/', NULL , 'weekly');
// Validate our sitemap (not really needed is we used the API to generate it!)
// Test validity of all urls in the sitemap
// This could take a very long time if sitemap is huge...
// Save sitemap to compressed file
// $sm->save('/path/to/web/root/sitemap1.gz');
// Notify Google about our sitemap update
// $sm->notify('http://my.web.site/sitemap1.gz');
// This is our sitemap: (output is not a function of File_Sitemap class!)
// Not an example with sitemap index
$sitemaps = array ('http://my.web.site/sitemap1.gz',
'http://my.web.site/sitemap2.gz',
'http://my.web.site/sitemap3.gz',
// It's a good idea to ensure that all sitemaps are reacheable...
// Save the sitemap index
// $smi->save('/path/to/wesite/root/sitemap.gz')
Documentation generated on Mon, 11 Mar 2019 15:46:43 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|