
Quick start
Different content for desktop and mobile on one page in about 5 minutes.
Step 1. Install
- Install MobileDetect via Extras → Installer (see overview)
- Ensure plugin MobileDetect is active and
md_disable_plugin = No - Clear the MODX cache
Step 2. Choose an output method
| You have pdoTools + Fenom | HTML template without Fenom |
|---|---|
| Fenom blocks (step 3a) | HTML tags (step 3b) |
Step 3a. Fenom blocks (recommended)
In a template or chunk parsed by pdoTools via Fenom:
fenom
{mobile}
<p>Content for phone and tablet</p>
{/mobile}
{desktop}
<p>Desktop content</p>
{/desktop}modx
[[!pdoPage?
&element=`tplContent`
]]The {mobile} block shows for mobile or tablet. For phone without tablet use {phone} (Integration).
Step 3b. HTML tags
In the resource body or template:
html
<standard>
<p>Desktop content</p>
</standard>
<mobile>
<p>Phone content</p>
</mobile>The plugin on OnWebPagePrerender removes extra blocks before sending the page. Tag names are configured via md_standard_node, md_mobile_node, md_tablet_node.
Внимание
MODX tags and snippets inside HTML blocks parse before filtering. For conditional heavy snippets prefer Fenom — see Integration.
Step 4. Verify
- Open the page with markup
- On desktop you see the
standard/{desktop}block - In mobile emulation or on a phone — the
mobile/{mobile}block - Forced mode: add
?browser=mobileto the URL (parameter name ismd_force_browser_variable, defaultbrowser)
Step 5. Version switcher (optional)
The package includes chunk tplMobileDetectSwitch — Desktop / Tablet / Mobile / Auto links:
fenom
{$modx->getChunk('tplMobileDetectSwitch')}modx
[[$tplMobileDetectSwitch]]Checklist
Next steps
- System settings — cookie, tablets as desktop, GET parameter names
- Integration — Fenom modifier, snippet, PHP API
- MobileDetect snippet — output without Fenom
