PHPackages                             derhaeuptling/contao-mobilecontent - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. derhaeuptling/contao-mobilecontent

AbandonedArchivedContao-module[Utility &amp; Helpers](/categories/utility)

derhaeuptling/contao-mobilecontent
==================================

MobileContent extension for Contao Open Source CMS

2.2.2(8y ago)71.6k2LGPL-3.0-or-laterPHPPHP &gt;=5.4.0

Since Jul 5Pushed 8y ago1 watchersCompare

[ Source](https://github.com/derhaeuptling/contao-mobilecontent)[ Packagist](https://packagist.org/packages/derhaeuptling/contao-mobilecontent)[ RSS](/packages/derhaeuptling-contao-mobilecontent/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (2)Dependencies (3)Versions (9)Used By (0)

Mobile Content (mobilecontent)
==============================

[](#mobile-content-mobilecontent)

This extension lets you show or hide specific articles, content elements and frontend modules on mobile or desktop devices. Image fields are extended – you can now add an different image for the mobile devices.

It works out of the box by recognizing the visitor user agent and displaying the appropriate content.
For use with CDN that caches the pages you may want to enable a separate mobile domain though (see explanation below).

The extension is compatible with Contao 3 and 4.

Toggle the content
------------------

[](#toggle-the-content)

To toggle the content you can either edit the element settings or simply use the icons available in the list view:

[![](docs/list-icons.png)](docs/list-icons.png)

Different mobile image
----------------------

[](#different-mobile-image)

To use a different image for mobile devices check `Different mobile image` on any elment with an image.

[![](docs/mobile-image.png)](docs/mobile-image.png)

Mobile domain
-------------

[](#mobile-domain)

In the website root settings you can enable the special domain for the mobile devices.
If mobile domain is enabled mobile and desktop layout will be distinguished by domain only.

[![](docs/website-root.png)](docs/website-root.png)

### Front end module

[](#front-end-module)

To allow easy switch between the desktop and mobile domains you can add the mobile/desktop switch front end module that displays a short information about the parallel domain and allows the visitors to switch to the correct version of the website for their device.

### Auto-redirect

[](#auto-redirect)

When the auto-redirect is enabled, right before the visitor is redirected to the correct version of the page the script adds the `mobile-content-redirecting` CSS class to the `` element.

**Note:** when this feature is enabled, the toggle links get the extra hash parameter to the URL. When the user visits a page with that parameter (e.g. by clicking the link) the cookie will be set that prevents from yet another redirect back. This allows e.g. the mobile visitors to be redirected to the mobile version of the website on first page view but they can still view the desktop version by explicitly clicking the link.

### mobile/desktop detection by Viewport

[](#mobiledesktop-detection-by-viewport)

If the Contao default mobile/desktop detection by User Agent does not fit your needs, you can alternatively activate detection by viewport width.
As this detection is done by JavaScript, the mobile/desktop switch front end module needs to be added to the layout.

Insert tags
-----------

[](#insert-tags)

#### mobile::toggle

[](#mobiletoggle)

Adds a link to toggle between desktop and mobile view. This link carries the classes `mobile_toggle` and `desktop`or 'mobile' corresponding to the destination of the link (not the type of page it is on!).

#### mobile::toggle\_url

[](#mobiletoggle_url)

Is replaced by the URL to the currently inactive view mode.

#### mobile::toggle\_text

[](#mobiletoggle_text)

Is replaced by the content of the language variable `$GLOBALS['TL_LANG']['MSC']['toggleDesktop'][0]` or `$GLOBALS['TL_LANG']['MSC']['toggleMobile'][0]`. This is normally the text of the standard toggle link created by `mobile::toggle`.

#### mobile::toggle\_title

[](#mobiletoggle_title)

Is replaced by the content of the language variable `$GLOBALS['TL_LANG']['MSC']['toggleDesktop'][1]` or `$GLOBALS['TL_LANG']['MSC']['toggleMobile'][1]`. This is normally the title of the standard toggle link created by `mobile::toggle`.

#### mobile::alternatives::alternative\_desktop:alternative\_mobile

[](#mobilealternativesalternative_desktopalternative_mobile)

This insert tags shows only one of the two alternatives `alternative_desktop` or `alternative_mobile` depending on which type of view is currently active. *Note:* there is a single semicolon between the two last chunks in the insert tag.

#### ifmobile \[…\] endifmobile, ifndesktop \[…\] endifndesktop

[](#ifmobile--endifmobile-ifndesktop--endifndesktop)

The content between the start and and tag is skipped if it appears on a desktop page.

#### ifdesktop \[…\] endifdesktop, ifnmobile \[…\] endifnmobile

[](#ifdesktop--endifdesktop-ifnmobile--endifnmobile)

The content between the start and and tag is skipped if it appears on a mobile page.

Developers
----------

[](#developers)

To check if the current page is mobile:

```
$GLOBALS['objPage']->isMobile
```

Example for the templates:

```

    mobile content

    desktop content

```

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 73.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~44 days

Recently: every ~65 days

Total

8

Last Release

2927d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8f738ebbbcb203ec68275ced0f3953f267a6c8e75eaa84d5e4fca383eb75e5cf?d=identicon)[DER HÄUPTLING](/maintainers/DER%20H%C3%84UPTLING)

---

Top Contributors

[![qzminski](https://avatars.githubusercontent.com/u/193483?v=4)](https://github.com/qzminski "qzminski (39 commits)")[![complanar](https://avatars.githubusercontent.com/u/4706846?v=4)](https://github.com/complanar "complanar (13 commits)")[![akroii](https://avatars.githubusercontent.com/u/8830861?v=4)](https://github.com/akroii "akroii (1 commits)")

---

Tags

contentmobilecontao

### Embed Badge

![Health badge](/badges/derhaeuptling-contao-mobilecontent/health.svg)

```
[![Health](https://phpackages.com/badges/derhaeuptling-contao-mobilecontent/health.svg)](https://phpackages.com/packages/derhaeuptling-contao-mobilecontent)
```

###  Alternatives

[codefog/contao-news_categories

News Categories bundle for Contao Open Source CMS

3183.3k6](/packages/codefog-contao-news-categories)[terminal42/contao-node

Node bundle for Contao Open Source CMS

3172.5k4](/packages/terminal42-contao-node)[dklemmt/contao_dk_mmenu

Implementation of mmenu as an extension for the Contao Open Source CMS.

1578.7k](/packages/dklemmt-contao-dk-mmenu)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
