Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
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 CreditAttribution: hutch commentedHave a look at the functions in getdirections.api.inc, there are several that will load a set of directions.
Comment #2
aufumy CreditAttribution: 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 CreditAttribution: hutch commentedComment #6
areikiera CreditAttribution: 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 CreditAttribution: 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 CreditAttribution: hutch commentedComment #9
matiaslezin CreditAttribution: 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 CreditAttribution: 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 CreditAttribution: hutch commentedI have commited code that removes the brackets if present, so the method described in #9 will also work now.
Comment #12
matiaslezin CreditAttribution: matiaslezin commentedThanks hutch!
Comment #13
matiaslezin CreditAttribution: 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 CreditAttribution: hutch commentedI can't spot anything wrong with this.
Comment #15
dropfen CreditAttribution: dropfen commented@mitiaslezin
What do you get, if you write something like
in your code?
Comment #16
matiaslezin CreditAttribution: matiaslezin commentedI'll give it a try later on and let you know.
Comment #17
matiaslezin CreditAttribution: matiaslezin commentedFatal error: Call to undefined function dpm()
What does that function does?
Comment #18
matiaslezin CreditAttribution: matiaslezin commentedFound the problem! The code was alright. It was something else from my website.
Thanks!