SVRegions

Detects the region based on the third-level subdomain and displays region-specific da
Packages
1
Downloads
1
Usually answers within 2 hours
Автор дополнения
Packages
1
Downloads
1
Usually answers within 2 hours
Version 1.2.3-pl
Release date 06.17.2026
Downloads 0
Views 3
Warning! This component requires PHP 8.1 or higher!
Warning! This package is not compatible with MODX 3.
SVRegions detects the region based on the current domain or subdomain and outputs the associated data through MODX placeholders. The component is designed for projects where the main domain and regional subdomains are served by a single MODX installation and share the same resources, templates, and chunks.

For example:
example.com
spb.example.com
kazan.example.com
samara.example.com

When spb.example.com is opened, the component selects the Saint Petersburg record, and when kazan.example.com is opened, it selects the Kazan record.

Adding a new region does not require creating a separate context or duplicating website resources. You only need to point the subdomain to the existing MODX installation and add a regional record. Standalone domains are also supported, provided that they are served by the same MODX installation from a single document root.

HOW THE COMPONENT WORKS

SVRegions retrieves the current host name from HTTP_HOST, finds the corresponding enabled region record, and sets placeholders with the region prefix.

The primary region is used:
  • for the main domain;
  • when no enabled record is found for the current domain;
  • as the source of fallback values for empty fields in other regions.

For example, each region can have its own city, address, and map while using the same phone number inherited from the primary region.

SUPPORTED DATA

The default configuration includes:
  • domain or subdomain;
  • city name;
  • city name in the prepositional case;
  • city name in the genitive case;
  • postal code;
  • address;
  • primary phone number;
  • primary phone number formatted for a tel: link;
  • secondary phone number;
  • secondary phone number formatted for a tel: link;
  • Yandex Maps link;
  • Yandex Maps embed code;
  • Yandex reviews widget code.
PLACEHOLDERS

Domain —
[[+region.domain]]
City —
[[+region.city]]
Prepositional case —
[[+region.locative]]
Genitive case —
[[+region.genitive]]
Postal code —
[[+region.index]]
Address —
[[+region.address]]
Primary phone number —
[[+region.phone]]
Phone number for a tel: link —
[[+region.phone_link]]
Secondary phone number —
[[+region.phone_2]]
Secondary phone number for a tel: link —
[[+region.phone_2_link]]
Yandex Maps link —
[[+region.yandex_link]]
Yandex Maps embed code —
[[+region.yandex_map]]
Yandex reviews widget —
[[+region.yandex_review]]

Additional technical placeholders:

Record ID —
[[+region.id]]
Creation date —
[[+region.createdon]]
Last modified date —
[[+region.editedon]]

The published and deleted system fields are not exposed as placeholders.

HOW TO USE THE PLACEHOLDERS

The placeholders are inserted into existing MODX templates and chunks. The package includes the SVRegionExample chunk with ready-to-use examples of regional placeholders. Its contents can be used as a reference when configuring your own templates and chunks.

The same template displays Saint Petersburg data on spb.example.com and Kazan data on kazan.example.com. The page structure and main content remain shared. Only the regional values change: city, address, phone numbers, map, and reviews.

REGION MANAGEMENT

After installation, a “Regions” section based on MIGX/MIGXdb appears in the MODX manager. Regional data is presented as clear, structured fields. A developer is not required for routine region creation and editing; these tasks can be handled by a website manager.

The section allows you to:
  • add and edit regional records;
  • edit domains and regional data;
  • enable and temporarily disable regions;
  • permanently remove records that are no longer needed.

A region’s status can be changed directly in the table by clicking the icon in the “Active” column:
  • a green tick means that the region is enabled;
  • a red cross means that the region is disabled.

A context menu is also available for each record:
  • “Edit”;
  • “Publish”;
  • “Unpublish”;
  • “Remove”.

Unpublishing a region does not delete its data. A disabled record can be enabled again at any time. If the record for the current domain is disabled, SVRegions uses the primary region data.

The “Remove” action permanently deletes the regional record from the database. Creating a backup before removing important data is recommended.

Each region must contain the exact domain or subdomain without a protocol, path, port, or trailing slash.

BENEFITS
  • a single MODX installation for the main website and regional domains;
  • shared resources, templates, and chunks;
  • adding a new region with a single record;
  • no duplicated pages or website elements;
  • centralized management of regional data;
  • data editing without developer involvement;
  • quickly enabling and disabling regions directly from the table;
  • inheritance of empty values from the primary region;
  • accurate and predictable region detection by domain;
  • no dependency on GeoIP;
  • support for third-level subdomains and standalone domains.

DIFFERENCE FROM CONTEXTS AND MULTILINGUAL COMPONENTS

SVRegions does not replace MODX contexts or multilingual components; it serves a different purpose. Contexts and multilingual solutions manage different versions of a website’s structure, pages, or languages. SVRegions is intended for cases where the website structure, resources, templates, and main content remain shared, while a limited set of regional data changes depending on the domain.

LIMITATIONS

SVRegions does not create domains or subdomains and does not configure DNS, the web server, or SSL certificates. All domains must be pointed in advance to the document root of the same MODX installation. The component does not detect a visitor’s location by IP address and does not switch cities automatically.

UNINSTALLATION

During a normal uninstall, the component files and elements are removed, including the plugin, manager menu item, MIGX configuration, system settings, and namespace.

The SVRegions table and all existing regional records are preserved. The saved data becomes available again after the component is reinstalled.

To remove all regional data permanently, the SVRegions table must be deleted separately after creating a backup.

COMPATIBILITY

MODX Revolution 2.6.0–2.8.x.
MIGX 2.13.0 or later.
PHP and MySQL versions compatible with the installed MODX version.
Development and primary testing were performed on MODX Revolution 2.8.8.

MODX Revolution 3 is not supported by the current version because the component uses MIGX/MIGXdb for the MODX 2 branch.