> How do you use geolocation information on your site today? How would you like > to use it? > Reply to this thread with ideas. We will use your suggestions to build a > meaningful case example.
We put our geolocation handling in a filter in the magnolia chain, which goes like this: - if a specific parameter is set in the request, the location is forced to the one corresponding to the parameter value - otherwise, if a location is already set as session/request attribute, just skip. - otherwise, if there is a cookie with the location value, that value is used as location - otherwise if the user is logged and has a location saved in its preferences, that location is used - otherwise if the user is not logged or without location, the user is localized using maxmind (the direct file ip-based location is scarcely accurate, free and quick enough to live in the filter) - otherwise a default is used - the location is then stored in a cookie - the same location is stored as request attribute (could also be session attribute) for other parts of the app - if the location was forced and the user was logged, it's stored in its preference There are some consideration about all of this: the filter must be tuned to be always quick and survive heavy traffic, which may be not as easy as you think. If your site is mostly static, having this logic in a filter will give the user the right localized page, event the right localized home page, without further redirects or ajax loading, but you have to be careful with the cache configuration to avoid serving to all the users the page localized for the first request. On the other side if you site is already ajax intensive, the filter might be almost an hindrance. You always have to give the user the possibility to change the location, in any case, especially if you change the language with the location. These concepts are general, but the implementation is not easy to extract in a reusable module, because the "location" object is completely dependent on your application implementation and logic. You may want a country-wise location to set the language or a neighbourhood-scale location to promote local events, so the list of available location will change, the localization method may vary and the way to convert the cookie/parameter value to a "location" object is know only to you application logic. Regards, Danilo. ---------------------------------------------------------------- For list details, see http://www.magnolia-cms.com/community/mailing-lists.html Alternatively, use our forums: http://forum.magnolia-cms.com/ To unsubscribe, E-mail to: <[email protected]> ----------------------------------------------------------------
