diff Sitemap.inc @ 124:6766250a0baa

Support for parameters as directory structure.
author Tom Fredrik Blenning Klaussen <bfg@bfgconsult.no>
date Fri, 29 Dec 2017 19:59:22 +0100
parents 74c22a8dd38f
children 6b882fb6ea46
line wrap: on
line diff
--- a/Sitemap.inc	Thu Dec 28 19:43:24 2017 +0100
+++ b/Sitemap.inc	Fri Dec 29 19:59:22 2017 +0100
@@ -72,11 +72,15 @@
   private function processDir($dir, $lang, $acceptedLanguages, $base) {
     $urls = array();
 
-    if ($handle = opendir(basePath() . "/${dir}")) {
+    $base=basePath();
+    $base=$_SERVER['DOCUMENT_ROOT'];
+    $baseurl = $_SERVER["REQUEST_SCHEME"] ."://". $_SERVER["SERVER_NAME"];
+
+
+    if ($handle = opendir($base . "/${dir}")) {
       while (false !== ($entry = readdir($handle))) {
 	if (endsWith($entry, '.xml')) {
-	  $fentry = basepath() . "/${dir}/${entry}";
-
+	  $fentry = $base . "/${dir}/${entry}";
 	  $doc = new DOMDocument();
 
 	  if (file_exists($fentry)) {
@@ -97,9 +101,7 @@
 	      }
 
 	      $optstring = genUrl($opts, array(), array('lang', 'name'));
-
-	      $location = "${base}${optstring}/";
-
+	      $location = "${baseurl}${optstring}/";
 	      array_push($urls, $location);
 	    }
 	  }