vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Template Modifications (https://vborg.vbsupport.ru/forumdisplay.php?f=246)
-   -   Show Thread Enhancements - Location links to Google Maps, Bing Maps or Yahoo Maps (https://vborg.vbsupport.ru/showthread.php?t=257943)

boydy 01-27-2011 10:00 PM

Location links to Google Maps, Bing Maps or Yahoo Maps
 
1 Attachment(s)
Hi guys,

This mod/hack let's you make a users location link to either Google Maps or Bing Maps. When you follow the hyperlink it opens the map at the location that the user has set. This can be done the the old horizontal postbit and the new vertical legacy postbit. Below is the code replacement for both maps and postbits.

=|= Install =|=

=|= Postbit (Vertical Legacy) =|=

Google Maps:

Open Template
- Postibit Templates -> postbit_legacy

Find -
Code:

<vb:if condition="$post['field2']"><dt>{vb:rawphrase location_perm}</dt> <dd>{vb:raw post.field2}</dd></vb:if>


Replace
-
Code:

<vb:if condition="$post['field2']"><dt>{vb:rawphrase location_perm}</dt> <dd><a href="http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q={vb:raw post.field2}" target="_blank">{vb:raw post.field2}</a></dd></vb:if>


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

Bing Maps:


Open Template - Postibit Templates -> postbit_legacy

Find -
Code:

<vb:if  condition="$post['field2']"><dt>{vb:rawphrase  location_perm}</dt> <dd>{vb:raw  post.field2}</dd></vb:if>


Replace
-
Code:

<vb:if condition="$post['field2']"><dt>{vb:rawphrase location_perm}</dt> <dd><a href="http://www.bing.com/maps/?v=2&where1={vb:raw post.field2}" target="_blank">{vb:raw post.field2}</a></dd></vb:if>
---------------------------------------------------------------------------------------

Yahoo Maps:


Open Template - Postibit Templates -> postbit_legacy

Find -
Code:

<vb:if  condition="$post['field2']"><dt>{vb:rawphrase  location_perm}</dt> <dd>{vb:raw  post.field2}</dd></vb:if>


Replace
-
Code:

<vb:if condition="$post['field2']"><dt>{vb:rawphrase location_perm}</dt> <dd><a href="http://maps.yahoo.com/#mvt=m&q1={vb:raw post.field2}" target="_blank">{vb:raw post.field2}</a></dd></vb:if>


=|= Postbit (Horizontal) =|=


Google Maps:

Open Template - Postibit Templates -> postbit

Find -
Code:

<vb:if  condition="$post['field2']"><dt>{vb:rawphrase  location_perm}</dt> <dd>{vb:raw  post.field2}</dd></vb:if>


Replace
-
Code:

<vb:if condition="$post['field2']"><dt>{vb:rawphrase location_perm}</dt> <dd><a href="http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q={vb:raw post.field2}" target="_blank">{vb:raw post.field2}</a></dd></vb:if>


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

Bing Maps:


Open Template - Postibit Templates -> postbit

Find -
Code:

<vb:if  condition="$post['field2']"><dt>{vb:rawphrase  location_perm}</dt> <dd>{vb:raw  post.field2}</dd></vb:if>
Replace -
Code:

<vb:if condition="$post['field2']"><dt>{vb:rawphrase location_perm}</dt> <dd><a href="http://www.bing.com/maps/?v=2&where1={vb:raw post.field2}" target="_blank">{vb:raw post.field2}</a></dd></vb:if>


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

Yahoo Maps:


Open Template - Postibit Templates -> postbit

Find -
Code:

<vb:if  condition="$post['field2']"><dt>{vb:rawphrase  location_perm}</dt> <dd>{vb:raw  post.field2}</dd></vb:if>


Replace
-
Code:

<vb:if  condition="$post['field2']"><dt>{vb:rawphrase  location_perm}</dt> <dd><a  href="http://maps.yahoo.com/#mvt=m&q1={vb:raw post.field2}"  target="_blank">{vb:raw  post.field2}</a></dd></vb:if>
And that's it! Screenshots below with some random locations and the resulting map search.

If you have any questions/problems or wish the location to link elsewhere and need help, post a comment and i'll help out as much as i can.

If you like this mod and/or using it please remember to mark as installed!

Thanks!

Boydy

Update 1.01 changelog;
  • Modified Google URL.
  • Hyperlink will now open in a new window.
  • Added Yahoo maps.

zelnik 01-28-2011 10:13 AM

what happens if someone puts in a location that :

a> Isn't a place (is the link still clickable?)
b> If there are more than one of the places (London for example, think there at least 3 in the world)

Looks a great idea though, tagged.

boydy 01-28-2011 10:21 AM

Quote:

Originally Posted by zelnik (Post 2155631)
what happens if someone puts in a location that :

a> Isn't a place (is the link still clickable?)
b> If there are more than one of the places (London for example, think there at least 3 in the world)

Looks a great idea though, tagged.

A - Well yes the link is still clickable as there isn't really an easy way for the system to determine whether it is a place or not. Let's be honest there are alot of obscure places in the world lol. Unfortunately nothing i can do about this.

B - It will go to the most well known place, people can be more specific in there location though. For example Perth, they could have the location set to Perth, UK or Perth, AU. Also the search results have a dropdown showing similar places...

Hope this helps :)

bulldog51981 01-29-2011 11:16 PM

For anyone in the U.S., this is the code that I used:

<vb:if condition="$post['field2']"><dt>{vb:rawphrase location_perm}</dt> <dd><a href="http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q={vb:raw post.field2}" target="_blank">{vb:raw post.field2}</a></dd></vb:if>

I also added the target="_blank" after the html page so that it opens in a new window or tab (depending on your settings) instead of opening in the page that you're on.

Great mod, members already love it and it's only been in a few mins!

boydy 01-30-2011 06:58 AM

Appologies i didn't even notice that it was .co.uk .

Will be updating the mod shortly anyway, glad you like it.

zelnik 01-30-2011 11:30 AM

Quote:

Originally Posted by boydy (Post 2156352)
Appologies i didn't even notice that it was .co.uk .

Will be updating the mod shortly anyway, glad you like it.

What do you plan on adding?

BadgerDog 01-30-2011 12:30 PM

Installed for testing with thanks ... :)

Seems to work well, except of course for people who put cute phrases in their locations instead of actualt locations .. :D

By the way, used bulldog's code instead of original...

Quote:

Originally Posted by bulldog51981 (Post 2156239)
For anyone in the U.S., this is the code that I used:

<vb:if condition="$post['field2']"><dt>{vb:rawphrase location_perm}</dt> <dd><a href="http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q={vb:raw post.field2}" target="_blank">{vb:raw post.field2}</a></dd></vb:if>

Regards,
Doug

boydy 01-30-2011 01:11 PM

Quote:

Originally Posted by zelnik (Post 2156399)
What do you plan on adding?

I'll be adding new maps shortly and hopefully make the install automated in time. Any suggestions on what people would like to see is welcome.

boydy 01-30-2011 06:56 PM

First update has been done. Enjoy guys and thanks to bulldog for the heads up regarding the URL. As ever any questions/suggestions post a comment and i'll get back to you!

flegul 01-31-2011 06:02 AM

Excellent :up: Nominated MOTM


All times are GMT. The time now is 07:18 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02581 seconds
  • Memory Usage 1,761KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (12)bbcode_code_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete