"; } } } else { if (($subdirectory!='.') && ($subdirectory!='..')){ walkDirTree($path.'/'); } } } } //Main Code starts here error_reporting(0); // turn off ugly errors // more silly stuff just to put something on the screen echo "$serverTalk Hello, how may I help you?
"; echo "
User @ $siteurl: I want you to generate a new SiteMap.XML file!
"; echo "$serverTalk Ok, hang on while I create a new Google® sitemap.xml file
"; // call to build the $files array starting at the path set in $sitePath, then we sort the array walkDirTree($sitePath); sort($files); // you could not do this - Google doesn't care either way // open the file with "write" privleges - this may fail on some servers if you don't have write privleges // this creates the sitemap.xml in the same folder that this script is located in // you can adjust this if needed - I keep the script in a folder, but want the xml file in the root // so I use "../sitemap.xml" in the fopen call below // if ($fp = fopen("sitemap.xml", "w")) { echo "
$serverTalk Writing sitemap.xml file to server ... "; // put the header info as specified by Google fputs($fp, ''."\n"); fputs($fp, ''."\n"); fputs($fp, '
$serverTalk I am Sorry Master - I encountered an Error: Could not write to 'sitemap.xml' file."; } echo ""; echo ""; echo ""; } ?>