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?
14
11
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)
$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...
...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!
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!
11
9
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