
GeoLocation2
MODX geodata — gl_* catalog, SxGeo, city picker modal, REST action.php


Takes visitor IP (or ip param), reads local SxGeo database, renders chunk with flat city_*, region_*, country_* placeholders. Does not change gl_cities or session.
Useful to debug SxGeo or show “detected region” without GeoLocation2Modal.
| Parameter | Default | Description |
|---|---|---|
tpl | tpl.GeoLocation2.location | Output chunk |
ip | visitor IP | Explicit IP for tests |
toPlaceholder | (empty) | Placeholder instead of echo |
[[!GeoLocation2Location]]
[[!GeoLocation2Location? &ip=`8.8.8.8`]]{'!GeoLocation2Location' | snippet : ['ip' => '8.8.8.8']}getCityFullByIp() → nested SxGeo array.city_name_ru, region_name_ru, …processData() adds city_name_ru_html, country_iso_html, etc.Keys depend on SxGeoCity.dat edition. Enable geolocation2_debug if chunk is empty.
<div class="geolocation2-location">
<span>Moscow</span>
…
</div>Returns empty string when .dat is missing, IP not found (127.0.0.1 on localhost), or service not registered.
See Integration → SxGeo, FAQ.