I created a contact form using the Webform module which creates a content type named 'webform'. I added the location cck field, named 'field_location', to the 'webform' content type. I am using GMap module 6.x-1.1 and I was able to get the map output from the location cck field on my page successfully. However, I would like to create a template file so I may print out the map separately from the $content variable.
I created the template file node-webform.tpl.php and the only method I was able to discover for printing out the map was:
<?php
* id - the id of the map every map on a page must have a unique id
* width - width of the map
* height - height of the map
* center - a string of the longitude and latitude of the centre of the map
* zoom - the zoom factor of the google map
* align - the alignment of the map 'right', 'left' or 'center'
* control - the control shown on the map 'Large', 'Small', or 'None'
* type - 'Map', 'Hybrid' or 'Satellite'
* points/markers - a string of points to mark on the map with + between each point
$points = array(
'id' => 'map'.$node->field_location[0]['lid'],
'width' => '320px',
'height' => '300px',
'latitude' => $node->field_location[0]['latitude'],
'longitude'=> $node->field_location[0]['longitude'],
'zoom' => 15,
'maptype' => 'Map',
'markers' => array(array(
'markername' => 'big red',
'text'=> $node->title,
'markermode'=> 1,
'opts'=> array('title'=> $node->title),
'latitude' => $node->field_location[0]['latitude'],
'longitude' => $node->field_location[0]['longitude'],
)),
);
print theme('gmap', array('#settings' => $points));
?>
The problem I have with this method is that the map is being displayed differently than if it was printed by the $content variable because I have already specified all of the settings for the map inside admin/settings/gmap. My question is how do I print the map out using these settings?
Comments
Comment #1
d3str0y commented