Turning the image into a link to google maps
authorLaury GvR <laury@gaslightmedia.com>
Tue, 15 Jul 2014 16:35:08 +0000 (12:35 -0400)
committerLaury GvR <laury@gaslightmedia.com>
Tue, 15 Jul 2014 16:35:08 +0000 (12:35 -0400)
Adding an <a> tag around the map image with an href to google maps
utilising the property[] array to create a dynamic link for directions.

Display was just changed to not show an empty image and address line
on the page play-11.

Toolkit/Property/Display.php
templates/template.html

index e424d89..f75dd85 100644 (file)
@@ -57,9 +57,10 @@ class Toolkit_Property_Display
                 $dbh,
                 $propertyId
             );
-            $property = ($property)
-                ? $property->getPropertiesAsArray()
-                : false;
+            if (!$property) {
+                return false;
+            }
+            $property = $property->getPropertiesAsArray();
             $mapImageName = "prop-{$propertyId}.png";
             if (file_exists(BASE . 'Toolkit/Property/Maps/' . $mapImageName)) {
                 $property['mapimg'] = $mapImageName;
index 8126e6e..76907ad 100644 (file)
                     <li><img src="{propImageStyle:h}{property[image2]:h}" flexy:if="property[image2]" /></li>
                 </ul>
                 {toolboxContent:h}
-                <address  flexy:if="property">
+                <address flexy:if="property">
                     {property[street]} &middot; {property[city]}, {property[state]} {property[zip]} &middot; {property[phone]} &middot; <a href="http://{property[url]}">{property[url]}</a>
                 </address>
-                <div id="googlemap">
-                    <img src="{mediaBaseURL:h}Toolkit/Property/Maps/{property[mapimg]:h}">
+                <div id="googlemap" flexy:if="property">
+                    <a href="http://maps.google.com/maps?q={property[street]},+{property[city]},+{property[state]},+{property[zip]}">
+                        <img src="{mediaBaseURL:h}Toolkit/Property/Maps/{property[mapimg]:h}">
+                    </a>
                 </div>
                 <div id="photoGallery">
                 </div>