Welcome, Guest. Please login or register.
Did you miss your activation email?


Login with username, password and session length

Search

 
Advanced search

8043 Posts in 1856 Topics- by 2099 Members - Latest Member: roi
Calendar Script CommunityCustomizationHacks and Mods (Moderators: scott, DanO, Marty)Yahoo Maps or Mapquest Mod?
Pages: [1] 2   Go Down
Print
Author Topic: Yahoo Maps or Mapquest Mod?  (Read 1646 times)
0 Members and 1 Guest are viewing this topic.
avimagic
New Member
*

Karma: 0
Offline Offline

Posts: 0

Web developer


WWW
« on: March 13, 2002, 10:20:00 AM »

Here's a mod idea that I think would be very useful for a lot of us:

I would love to see a mod that automatically creates a link to a Yahoo or Mapquest map based on address field(s) in an event.

Since most of our events are not necessarily in the same place, this would be quite helpful to site visitors!

Logged
avimagic
New Member
*

Karma: 0
Offline Offline

Posts: 0

Web developer


WWW
« Reply #1 on: March 14, 2002, 12:10:00 PM »

I figured out how to do it...

First, you need to create fields in the event database called address, city, state, and zip.

Then, simply add the following code to default.html in the Event View section immediately after the <% } %> tag:

<TR><TD colspan="2" ALIGN="center" VALIGN="top"><SPAN CLASS="text"><B><a href="http://www.mapquest.com/maps/map.adp?city=<%= $EVENT->{'details'}->{'city'} %>&state=<%= $EVENT->{'details'}->{'state'} %>&address=<%= $EVENT->{'details'}->{'address'} %>&zip=<%= $EVENT->{'details'}->{'zip'} %>&zoom=8" target="_blank">Click here for a map and directions</a></SPAN></TD></TR>

This will pop open a second window with the Mapquest map for your event's address.

Enjoy!

Avi Frier
VisionBurst.com

Logged
Scott
Guest
« Reply #2 on: March 14, 2002, 10:03:00 PM »

Do you have a public URL with an example?
That's cool  

------------------
Scott
CalendarScript.com


Logged
Zim
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #3 on: March 15, 2002, 10:19:00 AM »

Just hacked the same thing myself yesterday... tho not quite no nicely...

All you actually need are the street addr and zip code fields.... so add those fields to your events, and then edit your template (or maybe this fits a pug-in now, I dunno yet)...

I added to my event-only view, I suppose you can add anywhere you'd like... my events already had a "location" field (ie. at Bob's house, at the hockey rink, etc)..

code:

foreach $field (@$fields) {
            next unless ($db->{'properties'}->{$field}->{'display_details'});
                  #             next if    ($db->{'properties'}->{$field}->{'name'} eq "Zip");
                  #             next if    ($db->{'properties'}->{$field}->{'name'} eq "Street Addr");
   %>
                                 <TR><TD ALIGN="right" VALIGN="top"><SPAN
              CLASS="text"><B><%=$db->{'properties'}->{$field}->{'name'}%>: </B></SPAN></TD>
              <TD ALIGN="left" VALIGN="top"><SPAN CLASS="text"><%=$EVENT->{details}->{$field}%>
                <%
              if (($db->{'properties'}->{$field}->{'name'} eq  "Location") &&
                ($EVENT->{'details'}->{'zip'}) &&   ($EVENT->{'details'}->{'streetaddr'}) ){
                $EVENT->{'details'}->{'streetaddrurl'} = $EVENT->{'details'}->{'streetaddr'};
                $EVENT->{'details'}->{'streetaddrurl'} =~ s/\s/\+/g;
                %>
<!-- MAP -->
(<a href="http://mapquest.com/maps/map.adp?country=US&address=<%=$EVENT->{'details'}->{'streetaddrurl'}%>&zipcode=<%=$EVENT->{'details'}->{'zip'}%>&homesubmit.x =29&homesubmit.y=7">map</a> )
         <% } %>
   </SPAN></TD></TR>

         <% } %>


such an event can be seen at
http://www.raleighjaycees.org/cgi-bin/cal3.pl?view=Event&event_id=2

For mapquest, the street addr can also be "Main and 1st" to find an intersection. Note that what displays for humans to see (spaces), must be replaced with "+" for mapquest.

Cheers,
Mike

------------------

Logged
Scott
Guest
« Reply #4 on: March 15, 2002, 11:12:00 AM »

Very cool calendar with lots of customization, Zim  

------------------
Scott
CalendarScript.com


Logged
Zim
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #5 on: March 18, 2002, 07:14:00 AM »

Thanks.  Very cool engine under the hood  

Realized that adding the if... href statement to the list view (I only had it on single event view) made a lot of sense too.

Cheers,
Mike

------------------

Logged
avimagic
New Member
*

Karma: 0
Offline Offline

Posts: 0

Web developer


WWW
« Reply #6 on: March 18, 2002, 01:11:00 PM »

Mine's running at http://www.NetworkSouthFlorida.com/
Logged
Zim
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #7 on: March 19, 2002, 07:27:00 AM »

Looks good!

Mike

------------------

Logged
Steven
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #8 on: March 25, 2002, 02:57:00 AM »

I can't get either of these scripts additions to work. The first example I tried plugging in the code. Each time I click on the map link, the data from the fields (city, state, zip, address) are not being passed to the mapquest window. Therefore, no map. The second example, I can't even figure out what my custom fields are supposed to be named to get it to work. I'll try to look at it again and see if I can beat this thing into submission. Any tips or pointers are welcomed.

------------------

Logged
TubaDave
New Member
*

Karma: 0
Offline Offline

Posts: 0

Student


WWW
« Reply #9 on: March 25, 2002, 03:17:00 AM »

Steven,

The first solution will most likely fail if there are any spaces in the address.  If I'm reading the second solution correctly, you would only need three extra event fields:

"location" - a text description of the location. i.e. "At Bob's house."  The Display Name of this field must be "Location" (capital L) for the changes to work.

"zip" - the zip code.

"streetaddr" - the street address.

These are the Unique ID's for the fields.  Location should be the only one marked as "View in Event Details."  All three should be marked as "View in Add Form."

------------------
David Whittaker
http://www.uabcm.com/  
http://www.csworkbench.com/  


Logged

Zim
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #10 on: March 25, 2002, 07:03:00 AM »

TubaDave has the right of it... although I actually do display street addr and zip in the event details (at least for now as a debug tool).

So you do need the additional 3 custom fields for my hack (and a hack is what I consider it without more prettying up).  Although really you could do away with location, and keep addr/zip hidden and just diplay a "product" field, that being the link to mapquest.

You should be able to "test" your link by hovering over it and seeing what it says...

it should resemble...
http://mapquest.blah.blah?country=US&address=111+main_st&zipcode=12345&homesubmit.x=29&homesubmit.y=7

You can also speicify city and state if you already have that info in your calendar, but those fields are redundant to the zip code, so I didn't add them since I had no other need for them.

Step 1... add location, streetaddr and zip to your calendar.. make them visible, and see if you can display that data

Step 2... add the product link in (the if statement)

Cheers,
Mike

------------------

Logged
Steven
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #11 on: March 25, 2002, 03:09:00 PM »

So far no luck with either solution. Perhaps I'm causing more trouble with other changes I've made. I've changed the way the events are viewed to the pop-up windows from the oldstyle template. Perhaps this is interferring with the changes I'm trying to make.

Random thought to puzzle over: since I am calling event_detail.html to display the events, is it possible that the variables are not being passed to the new window??? Is there some sort of mass-include that I need to do in the code for event_detail.html??? Just a thought that could be totally wrong...

------------------

Logged
Zim
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #12 on: March 25, 2002, 05:38:00 PM »

Make sure for debug purposes that you print all details of an event (to be sure they are there).  Go back later and make them not print once you have it working.

Mike

------------------

Logged
vr6
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #13 on: January 23, 2003, 02:58:00 PM »

I am trying to implement these changes but running into a problem. I pasted the code just beneath the <!-- EVENT VIEW --> line of the default/default.html file. I keep getting the following error message:

ERROR PROCESSING TEMPLATE
There was an error in your template file. Below is the template file and also the perl code generated from it to help you with debugging.

Unmatched right curly bracket at (eval 1) line 292, at end of line syntax error at (eval 1) line 292, near ";}"

You can view the entire error at the following URL:
http://www.vr6.com/calendar_error.html

Thanks,
Ty

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #14 on: January 23, 2003, 08:22:00 PM »

** You can view the entire error at the following URL: **

What we'de need to see would be the raw code from the template file.
Cut and paste 10-15 lines of the code before and after the line the
error occurs on (pointing the error line out) and we'll try to spot any errors.

Going by the error message, I'd be looking for an
Unmatched right curly bracket or one there that
shouldn't be. Maybe it's suppose to be a regular
bracket ) or an > and not an }

Dan O.


[This message has been edited by DanO (edited January 23, 2003).]

Logged
Pages: [1] 2   Go Up
Print
Jump to: