By ALT83 on
Using Gmap.module and Location.module I've successfully created a new node type called "Map" that allows people to click on a Google map that will place a marker on a map and fill in the necessary Longitude and Latitude fields.
My problem is, when the node is saved, it only displays it as a list of the details, e.g.
Location
Taipei
Taiwan
25° 2' 1.284" N, 121° 33' 52.0596" E
What I want to be able to do is to render these details in an actual map.
Using ConTemplate.module I have access to those raw coordinates as print $node->locations[0]['latitude'] and print $node->locations[0]['longitude'] but am not sure what the rest of the embed code should be...
Any help would be greatly appreciated.
Thanks,
Alex
Comments
I think you can use the
I think you can use the function provided by gmap module.
for example:
print gmap_simple_map($node->locations[0]['latitude'], $node->locations[0]['longitude'] ,'', '', 15);
You can find the function in gmap.module line 1124
function gmap_simple_map($latitude, $longitude, $markername = '', $info = '', $zoom = 'auto', $width = 'default', $height = 'default', $autoshow = FALSE, $map = array())
Thanks!
Seems like you were spot on with that! Worked perfectly! :)
I do have a follow-up question though. When I click the marker that makes on my map, it creates an empty speech bubble. Is there any way to put the title of my node in that spot and/or other HTML code in to that speech bubble?
Thanks!
Alex
Just play arround with the
Just play arround with the variables in this function:
function gmap_simple_map($latitude, $longitude, $markername = '', $info = '', $zoom = 'auto', $width = 'default', $height = 'default', $autoshow = FALSE, $map = array())
I think $info ist what you are looking for:
like:
print gmap_simple_map($node->locations[0]['latitude'], $node->locations[0]['longitude'] ,'', 'THIS IS YOUR INFO', 15);
Nicolas.
I managed to use that to get
I managed to use that to get the title, but my limited knowledge of PHP means I don't know how to have multiple fields such as body content etc. in that same bit without getting a PHP error
This is what I have so far, how can include extra fields such as $node->content['body']['#value'] beneath the title in the box without getting errors?:
I'm also interested, is there a way to automatically render a static image like a Gif or Jpeg from these coordinates set to certain dimensions (e.g. 150px x 113px) which I could then use in teasers as opposed to the Javascript map itself?
Thanks for your continued great help :)
Alex
Could you post - the
Could you post
- the PHP-Code, that gives the error
- the error message
I think you could fill any HTML-Code into $info.
I don't think, that there is an easy way to render a static image, but I'm not that familar with google maps.
if my understanding is
if my understanding is correct, u are on the wrong way ....
looks u mixed up the usages of the 2 modules.
try step back, re-state what u really want?
good luck
This is what works for
This is what works for me:
Any alternative (HTML tags etc.) produces the following: Parse error: syntax error, unexpected '<' in /webroot/a/s/asian015/woosh/www/modules/contemplate/contemplate.module(851) : eval()'d code on line 1
The above produces a Google map with a pin on it in a location as defined by the user on node creation. When that pin is clicked, a speech bubble comes up with the node's title in it. Ideally I would like more information in there as well and be able to format it using HTML tags.
That's the first thing I'd like to do and is what appears in the full body view for my nodes. For the teaser though I'm thinking maybe some way to automatically render a static gif or jpeg of smaller dimensions (e.g. 150px by 113px) would be better, particularly when I have lots of nodes on the same page so as to not have too many large Javascript maps load.
Hope that clears things up :)
Thanks
Alex
I don't use contemplate. I
I don't use contemplate.
I use a special template: node-.tpl.php
There i could use html for $info.
I don't know if it's possible to render a static image.
Nicolas.
I'm probably formatting it
I'm probably formatting it wrong (as I'm pretty sure you can't nest PHP tags), but neither of the following works:
I assume I need to format the HTML tags in some way that's PHP friendly?
Wish I knew PHP better :-s
You realy shoul'd read about
You realy shoul'd read about php ;-)
for example:
http://de3.php.net/manual/en/language.types.string.php
try this:
With . you can connect strings.
for example:
dupe
dupe