summaryrefslogtreecommitdiffstats
path: root/includes/maps.php
diff options
context:
space:
mode:
authorPatrick Davison <snapwilliam@gmail.com>2012-02-02 22:39:09 -0800
committerPatrick Davison <snapwilliam@gmail.com>2012-02-02 22:39:09 -0800
commit1eeb95fcde8e23ea9493d74232f9e38d3fad6d02 (patch)
treea5643675b0c5a6926238307846661c1b64c203d5 /includes/maps.php
parent7257ddcadc19f119c97d1ab8996ffafc8f863fd5 (diff)
downloadpathery-1eeb95fcde8e23ea9493d74232f9e38d3fad6d02.tar.xz
Fix for JSON "MapData" div issue for search engines.
Diffstat (limited to 'includes/maps.php')
-rw-r--r--includes/maps.php19
1 files changed, 11 insertions, 8 deletions
diff --git a/includes/maps.php b/includes/maps.php
index 6a8512c..a6787a7 100644
--- a/includes/maps.php
+++ b/includes/maps.php
@@ -104,12 +104,9 @@ function DisplayMap($mapMatrix, $idprefix = 1, $style = 'normal', $speed = NULL)
$i -= 1;
$height = (($i * 35) + -1).'px';
//$height = (($i * 22) + 2).'px';
-
- $jsonmap = json_encode($mapdata);
-
-
-
+ $jsonmap = str_replace("'", "\'", json_encode($mapdata));
+
//This works in chrome, not sure about others.
$preloaddiv .= "
<div style='visibility:hidden;display:none'>
@@ -122,9 +119,15 @@ function DisplayMap($mapMatrix, $idprefix = 1, $style = 'normal', $speed = NULL)
<img src='images/OverlayTileFaceted10.png' alt=''>
</div>";
- $mapdatadiv .= "<div id='$idprefix,mapdata' style='visibility:hidden;display:none'>";
- $mapdatadiv .= $jsonmap;
- $mapdatadiv .= '</div>';
+ //$mapdatadiv .= "<div id='$idprefix,mapdata' style='visibility:hidden;display:none'>";
+ //$mapdatadiv .= $jsonmap;
+ //$mapdatadiv .= '</div>';
+
+ //JSON Fix for search-engine cache.
+ $mapdatadiv = "<script>
+ jsonmapdata['$idprefix'] = '$jsonmap';
+ </script>";
+
$maptable = "$preloaddiv
<table style='width:$width;height:$height;' class='grid_table'>