PHPackages                             trilobit-gmbh/contao-ifthenelse-bundle - 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. trilobit-gmbh/contao-ifthenelse-bundle

ActiveContao-bundle

trilobit-gmbh/contao-ifthenelse-bundle
======================================

Contao 4 / Contao 5 ifthenelse bundle

3.0.0(2mo ago)0560LGPL-3.0-or-laterPHPPHP ^8.0

Since Apr 11Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/trilobit-gmbh/contao-ifthenelse-bundle)[ Packagist](https://packagist.org/packages/trilobit-gmbh/contao-ifthenelse-bundle)[ RSS](/packages/trilobit-gmbh-contao-ifthenelse-bundle/feed)WikiDiscussions main Synced 2mo ago

READMEChangelog (7)Dependencies (4)Versions (8)Used By (0)

IfThenElse Bundle
=================

[](#ifthenelse-bundle)

Das IfThenElse Bundle stellt die Symfony ExpressionLanguage über die InsertTag Notation zur Verfügung. Damit lassen sich einfache Abfragen und davon abhängige Ausgaben realisieren.

Aufbau
------

[](#aufbau)

Damit die Erweiterung den Insert-Tag als solchen erkennen kann, muss eine bestimmte Struktur benutzt werden. Diese sieht wie folgt aus: `{{sel::Bedingung::Ausgabe}}`

### Variablen und Funktionen

[](#variablen-und-funktionen)

- app.isoDate `// Date::parse('Y-m-d')`
- app.isoTime `// Date::parse('H:i')`
- app.minute `// Date::parse('i')`
- app.hour `// Date::parse('H')`
- app.day `// Date::parse('d')`
- app.month `// Date::parse('m')`
- app.year `// Date::parse('Y')`
- app.date `// Date::parse('Ymd')`
- app.time `// Date::parse('Hi')`
- app.tstamp `// time()`
- app.tools.dateDiff(dateA, dateB, 'days') `// days, y, m, d, h, i, s`
- member.\[...\]
- page.\[...\]

### Beispiele

[](#beispiele)

Tageszeitabhängige Begrüßung auf der Website

```
{{sel::app.hour >= 22 OR (app.hour >= 0 && app.hour < 5)::Gute Nacht}}
{{sel::app.hour >=  5 && app.hour < 10::Guten Morgen}}
{{sel::app.hour >= 10 && app.hour < 14::Guten Tag}}
{{sel::app.hour >= 14 && app.hour < 16::Guten Nachmittag}}
{{sel::app.hour >= 16 && app.hour < 18::Gute Kaffeezeit}}
{{sel::app.hour >= 18 && app.hour < 22::Guten Abend}}

```

Die Ausgabe ist dann wie folgt:

- zwischen 22 Uhr und 5 Uhr: `Gute Nacht`
- zwischen 5 Uhr und 10 Uhr: `Guten Morgen`
- zwischen 10 Uhr und 14 Uhr: `Guten Tag`
- zwischen 14 Uhr und 16 Uhr: `Guten Nachmittag`
- zwischen 16 Uhr und 18 Uhr: `Gute Kaffeezeit`
- zwischen 18 Uhr und 22 Uhr: `Guten Abend`

Vergleich zwei Datum:

```
{{sel::app.tools.dateDiff('now', page.tstamp, 'days') > 14::todo}}
{{sel::app.tools.dateDiff('now', page.tstamp, 'days') < 14::OK}}

```

Ausgabe: Ist die Differenz von 'now' und dem Timestamp der Seite älter als 14 Tage wird `todo` ausgegeben.

IfThenElse Bundle
=================

[](#ifthenelse-bundle-1)

The IfThenElse bundle provides the Symfony ExpressionLanguage via the InsertTag notation. This allows for the implementation of simple queries and dependent outputs. `{{sel::Bedingung::Ausgabe}}`

### Variables and functions

[](#variables-and-functions)

- app.isoDate `// Date::parse('Y-m-d')`
- app.isoTime `// Date::parse('H:i')`
- app.minute `// Date::parse('i')`
- app.hour `// Date::parse('H')`
- app.day `// Date::parse('d')`
- app.month `// Date::parse('m')`
- app.year `// Date::parse('Y')`
- app.date `// Date::parse('Ymd')`
- app.time `// Date::parse('Hi')`
- app.tstamp `// time()`
- app.tools.dateDiff(dateA, dateB, 'days') `// days, y, m, d, h, i, s`
- member.\[...\]
- page.\[...\]

### Examples

[](#examples)

Time-of-day-dependent greeting on the website

```
{{sel::app.hour >= 22 OR (app.hour >= 0 && app.hour < 5)::Good night}}
{{sel::app.hour >=  5 && app.hour < 10::Good morning}}
{{sel::app.hour >= 10 && app.hour < 14::Good afternoon}}
{{sel::app.hour >= 14 && app.hour < 16::Good afternoon}}
{{sel::app.hour >= 16 && app.hour < 18::Enjoy your coffee}}
{{sel::app.hour >= 18 && app.hour < 22::Good evening}}

```

The output is then as follows:

- between 10 p.m. and 5 a.m.: `Good night`
- between 5 a.m. and 10 a.m.: `Good morning`
- between 10 a.m. and 2 p.m.: `Good afternoon`
- between 2 p.m. and 4 p.m.: `Good afternoon`
- between 4 p.m. and 6 p.m.: `Enjoy your coffee`
- between 6 p.m. and 10 p.m.: `Good evening`

Comparing two dates:

```
{{sel::app.tools.dateDiff('now', page.tstamp, 'days') > 14::todo}}
{{sel::app.tools.dateDiff('now', page.tstamp, 'days') < 14::OK}}

```

Output: If the difference between 'now' and the page timestamp is older than 14 days, `todo` is output.

Installation
------------

[](#installation)

Install the extension via composer: [trilobit-gmbh/contao-ifthenelse-bundle](https://packagist.org/packages/trilobit-gmbh/contao-ifthenelse-bundle).

Compatibility
-------------

[](#compatibility)

- (Contao version ~4.13)
- Contao version ~5.3
- Contao version ~5.7

###  Health Score

48

—

FairBetter than 94% of packages

Maintenance86

Actively maintained with recent releases

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~481 days

Recently: every ~721 days

Total

7

Last Release

68d ago

Major Versions

1.0.4 → 2.0.02024-05-03

2.0.0 → 3.0.02026-03-05

PHP version history (3 changes)1.0PHP ^5.6|^7.0

2.0.0PHP ^7.3 || ^8.0

3.0.0PHP ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7868402?v=4)[trilobit-gmbh](/maintainers/trilobit-gmbh)[@trilobit-gmbh](https://github.com/trilobit-gmbh)

---

Top Contributors

[![trilobit-gmbh](https://avatars.githubusercontent.com/u/7868402?v=4)](https://github.com/trilobit-gmbh "trilobit-gmbh (25 commits)")

###  Code Quality

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/trilobit-gmbh-contao-ifthenelse-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/trilobit-gmbh-contao-ifthenelse-bundle/health.svg)](https://phpackages.com/packages/trilobit-gmbh-contao-ifthenelse-bundle)
```

###  Alternatives

[codefog/contao-haste

haste extension for Contao Open Source CMS

42650.8k139](/packages/codefog-contao-haste)[madeyourday/contao-rocksolid-custom-elements

Create your own, nestable content elements using a modular system. End the WYSIWYG chaos with your own content elements.

50341.9k12](/packages/madeyourday-contao-rocksolid-custom-elements)[contao/manager-bundle

Provides the Contao Managed Edition

181.3M61](/packages/contao-manager-bundle)[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)[terminal42/contao-folderpage

Provides a new page type for Contao that allows you to group pages into folders.

18147.9k9](/packages/terminal42-contao-folderpage)

PHPackages © 2026

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