{jr_geo_locate}
The {jr_geo_locate} template function is used to lookup the Geographical Location of a viewer, using their IP address to find their (approximate) location.
NOTE: This template function is part of the jrGeoLocate module, which must be installed in order for the {jr_geo_locate} function to work.
Parameters:
Name |
Type |
Required |
Default |
Description |
ip |
ip_address |
no |
$jamroom['ip_address'] |
The "ip" parameter tells Jamroom the IP Address to use in the Geo Location request. By default, the viewing user's IP Address is used. |
format |
string |
no |
"%City, %RegionName" |
The "format" parameter tells Jamroom the "format" of the output, and how you want it displayed. The Geo Location lookup will result in several "fields" being made available for use in the format string - they are:
- %Ip - the IP Address
- %CountryCode - the Country Code for the IP
- %CountryName - the Country Name for the IP
- %RegionCode - the Region Code for the IP
- %RegionName - the Region Name for the IP
- %City - the City name for the IP
- %ZipPostalCode - the Postal ZIP Code for the IP
- %Latitude - the Latitude for the IP
- %Longitude - the Longitude for the IP
|
assign |
string |
no |
n/a |
If you would like the output of the function to be assigned to a template variable instead of displayed, use the "assign" parameter to tell Jamroom the name of the variable to save the output to. |
Examples:
embedded {jr_geo_locate} function call in a Template:
{* Default - shows City, Region *}
{jr_geo_locate}
{* Show Latitude and Longitude, and save to template variable $latlong *}
{jr_geo_locate format="%Latitude,%Longitude" assign="latlong"}
{* use location as search in Jamroom Ranking System *}
{jr_geo_locate format="%City" assign="city"}
{jr_ranking mode="artist" search_area="band_location" search_string=$city row_template="jr_ranking_row.tpl" show="5"}
|
|