Welcome to Geeklog, Anonymous Friday, November 22 2024 @ 01:36 am EST

Geeklog Forums

Map Event Address hack?


Mark Bradbourne

Anonymous
Is this possible? Take the address of an upcoming event, then link to map quest/yahoo maps and generate a map? Anyone done it?
 Quote

Status: offline

zipstart

Forum User
Chatty
Registered: 09/13/04
Posts: 60
Try this...

Add the following to calendar_event.php BEFORE $cal_templates->parse('event_details', 'details', true); (line 608 on mine)

Text Formatted Code
//code added for MapQuest link
                $e_ad1 = $A['address1'];
                $e_ad2 = $A['address2'];
                $e_city = $A['city'];

                $e_ad1_fixed = str_replace(' ','+',$e_ad1);
                $e_ad2_fixed = str_replace(' ','+',$e_ad2);
                $e_city_fixed = str_replace(' ','+',$e_city);

                $map = '<a href ="http://www.mapquest.com/maps/map.adp?country=US&countryid=US&addtohistory=&searchtab=address&searchtype=address&address=';

                $map .= $e_ad1_fixed;
                if (strlen($e_ad2_fixed) > 1)
                                {
                                        $map .= '+' . $e_ad2_fixed;
                                }
                $map .= '&city=';
                $map .= $e_city_fixed;
                $map .= '&state=';
                $map .= $A['state'];
                $map .= '&zipcode=';
                $map .= $A['zipcode'];
                $map .= '&search=++Search++">Map It!</a>';

                $cal_templates->set_var('maplink', $map);
                    // END Mapquest link code
 


Then add...
Text Formatted Code
{maplink}
 

...to /layout/eventdetails.thtml

Should work! Let me know if you have questions and...as always...it may work on my site but not yours...back up your files first!
 Quote

Status: offline

mrb42

Forum User
Junior
Registered: 10/15/04
Posts: 20
Thanks! Works like a champ! I did add a (target="blank") to the URL to open it in a new window...

Check it out! http://neohmusic.com/calendar_event.php?mode=&eid=20041025224720570
 Quote

Status: offline

zipstart

Forum User
Chatty
Registered: 09/13/04
Posts: 60
Good call on the new window...glad it worked.
 Quote

Status: offline

zipstart

Forum User
Chatty
Registered: 09/13/04
Posts: 60
Oh...and tho I think Mapquest is pretty static on how they parse URLs, keep an eye on this hack as sites do update their process from time to time...may break your links.
 Quote

Status: offline

mrb42

Forum User
Junior
Registered: 10/15/04
Posts: 20
hadn't thought about that... thanks, I'll try and keep an eye on it.
 Quote

All times are EST. The time is now 01:36 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content