Closed (works as designed)
Project:
Get Directions
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
11 Aug 2010 at 16:39 UTC
Updated:
5 Mar 2013 at 00:01 UTC
To embed the getdirections map in a node, I added this
echo getdirections_direction();
Default values were set with hook_form_alter() for the 'from' and 'to'
I am trying to figure out how to get the form to load on page load, so that by default some directions are shown.
Or alternatively, to load an screenshot of the map and div with instructions for driving directions, and then on form load, replacing that with the actual information.
Any suggestions?
Comments
Comment #1
hutch commentedHave a look at the functions in getdirections.api.inc, there are several that will load a set of directions.
Comment #2
aufumy commentedI looked at the api functions, and saw that most returned a link, I am not sure how to embed that in my node, except as an iframe.
I ended up taking the easier way out by embedding a google map with driving directions into the node
http://thewichitacomputerguy.com/blog/embed-google-maps-drupal-node-with...
Comment #3
brenda003I ended up using the getdirections_locations_via() function to get a map automatically displayed with various waypoints from the module file itself.
Comment #4
hutch commentedComment #6
areikiera commentedHello! I'm not familiar with how to use functions to get the getdirections map to preload the node's "From" value. I created the block with the code from the very first post, but the "From" value was not automatically preloaded, and I'm not sure if it was supposed to.
Could someone explain in more detail how this is accomplished?
(Using the Location CCK field)
Thanks!
Comment #7
hutch commentedHave a look at the comments in getdirections.api.inc and in the README.
For instance:
"getdirections/location/from/[nid]"Where [nid] is the node id of the location enabled node. Build a link with a path like that and it will have From preset.
If you have Views installed you can have a block that will appear when viewing the node. You can edit the view eg add a display that uses 'from' instead of 'to'.
Comment #8
hutch commentedComment #9
matiaslezin commentedIf it's any help, I used getdirections_locations_bylatlon in a block (if you have 2 location cck fields) and added it to the content page of a node. For instance,
Comment #10
hutch commentedAlmost, but the brackets around the lat,lon sets confuse the javascript and cause it to show a map in china.
This puts it where you intended.
Comment #11
hutch commentedI have commited code that removes the brackets if present, so the method described in #9 will also work now.
Comment #12
matiaslezin commentedThanks hutch!
Comment #13
matiaslezin commentedI'm having a problem in Drupal 7. I'm using the code:
Everything should be working, but the map is showing me from the same point to the same point. I've checked the values of the latitudes and longitudes and both are ok. It's like it thinks it's going from the start point to the start point.
Any ideas?
Comment #14
hutch commentedI can't spot anything wrong with this.
Comment #15
dropfen commented@mitiaslezin
What do you get, if you write something like
in your code?
Comment #16
matiaslezin commentedI'll give it a try later on and let you know.
Comment #17
matiaslezin commentedFatal error: Call to undefined function dpm()
What does that function does?
Comment #18
matiaslezin commentedFound the problem! The code was alright. It was something else from my website.
Thanks!