As Continuing from the previous section GeoLocal :: Filter (1), we like to demonstrate more GeoLocal Filter features in this section. Here are the another code fragment and a complete example (simple4.html).


<div class="glFilter" group="Store" country="US" region="CA" city="San Francisco,Sacramento">
  <center>
    <h3 style="color:blue">Northern California Store</h3>
    <img src="FoodNorth.gif">
  </center>  
</div>

<div class="glFilter" group="Store" country="US" region="CA" city="Los Angeles,San Diego">
  <center>
    <h3 style="color:red">Southern California Store</h3>
    <img src="FoodSouth.gif">
  </center>  
</div>

<div class="glFilter" group="Store">
  <center>
    <h3 style="color:green">California Stores</h3>
    <ol>
      <li><a href=FoodNorth.gif style="color:blue">Northern California Store</a>
      <li><a href=FoodSouth.gif style="color:red">Southern California Store</a>
    </ol>
  </center>  
</div>

The logic of the above code fragment is following :

  1. Set the class of HTML element containers (<div>) to be "glFilter". These containers won't be displayed until its specified GeoLocal criteria (country, region, and city) are matched.

  2. Set the group of these containers to be the value "Store".

  3. In the above example, if the web site visitor is from United States (country="US"), California (region="CA"), San Francisco or Sacramento (city="San Francisco,Sacramento"), the following information will displayed:


  4. If the web site visitor is from United States (country="US"), California (region="CA"), Los Angeles or San Diego (city="Los Angeles,San Diego"), the following information will displayed:


  5. If the web site visitor isn't coming from the above four cities of California in United States, the following information will displayed:





Notes :
  • There are three GeoLocal criteria (country, region, and city) can be specified, and each criterion can have multiple values in it (for example: region="AZ,CA,NV", the values are delimetered by commas.).

  • There can be multiple groups (for example: "language", "local branch", ...) specified in an HTML document.

  • geolocal.js stores the user's GeoLocal information in the Javascript variable $glinfo. Sometimes for testing prurposes, the web site developer can get or set the GeoLocal information with the member fields of $glinfo:
    • $glinfo.country
    • $glinfo.region
    • $glinfo.city

  • Here is a simple example (simple5.html) which simulates the web site visitor is from Los Angeles, California, United States.


© 2010 ToGo Software. All rights reserved.