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.
$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;
<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]} · {property[city]}, {property[state]} {property[zip]} · {property[phone]} · <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>