Skip to content

Instantly share code, notes, and snippets.

@devpilot
Created April 16, 2013 17:02
Show Gist options
  • Save devpilot/5397607 to your computer and use it in GitHub Desktop.
Save devpilot/5397607 to your computer and use it in GitHub Desktop.
links store file generator
<?php
$doc = new DOMDocument('1.0');
$doc->formatOutput = true;
$doc->preserveWhiteSpace = false;
@$doc->load('sitemap.xml') or die('failed to load file'); //load xml file
$t1 = $doc->createElement('url');
$loc = $doc->createElement('loc', "http://www." . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
$t1->appendChild($loc);
$priority = $doc->createElement('priority', '0.20');
$t1->appendChild($priority);
$doc->importNode($t1);
$doc->documentElement->appendChild($t1);
@$doc->save('sitemap.xml') or die('failed to save file'); // save xml file;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment