{"id":25839722,"url":"https://github.com/netresearch/t3x-contexts","last_synced_at":"2025-11-17T19:04:12.041Z","repository":{"id":7377673,"uuid":"8704810","full_name":"netresearch/t3x-contexts","owner":"netresearch","description":"Contexts for TYPO3 – can be used to modify page behaviour in the frontend based on several conditions","archived":false,"fork":false,"pushed_at":"2025-11-17T13:21:40.000Z","size":1083,"stargazers_count":10,"open_issues_count":1,"forks_count":11,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-11-17T15:12:25.145Z","etag":null,"topics":["multi-channel","typo3-extension"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/netresearch.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2013-03-11T14:10:52.000Z","updated_at":"2025-11-17T13:21:45.000Z","dependencies_parsed_at":"2023-02-17T19:01:10.857Z","dependency_job_id":"e7491cfe-fa1f-4521-ad5a-6f01e6c8c6f4","html_url":"https://github.com/netresearch/t3x-contexts","commit_stats":{"total_commits":238,"total_committers":17,"mean_commits":14.0,"dds":0.634453781512605,"last_synced_commit":"7e2da48e083ab0cd595e4f91ea2f4afddd08f9e0"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/netresearch/t3x-contexts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netresearch%2Ft3x-contexts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netresearch%2Ft3x-contexts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netresearch%2Ft3x-contexts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netresearch%2Ft3x-contexts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/netresearch","download_url":"https://codeload.github.com/netresearch/t3x-contexts/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netresearch%2Ft3x-contexts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":284939286,"owners_count":27087872,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-17T02:00:06.431Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["multi-channel","typo3-extension"],"created_at":"2025-03-01T04:34:10.709Z","updated_at":"2025-11-17T19:04:12.021Z","avatar_url":"https://github.com/netresearch.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Latest version](https://img.shields.io/github/v/release/netresearch/t3x-contexts?sort=semver)\n![License](https://img.shields.io/github/license/netresearch/t3x-contexts)\n![PHPStan](https://github.com/netresearch/t3x-contexts/actions/workflows/phpstan.yml/badge.svg)\n![PHPCodeSniffer](https://github.com/netresearch/t3x-contexts/actions/workflows/phpcs.yml/badge.svg)\n![CodeQL](https://github.com/netresearch/t3x-contexts/actions/workflows/codeql-analysis.yml/badge.svg)\n\n\n# Multi-channel contexts\n\nShow and hide pages and content elements based on configurable \"contexts\".\nWith the use of contexts, TYPO3 is able to do multichannel output.\n\nExamples for contexts:\n\n- Screen size \u003c 500px\n- Browser runs on a tablet or mobile phone\n- Location is 15km around a certain place\n- User is from one of certain countries\n- User entered website with GET-Parameter ``affID=foo``\n- User IP matches a given rule\n- A session variable is set\n- A combination of any other rules\n\nApart from the context rules, this extension also provides an API to use\ncontexts in your own extensions.\n\n\n\u003c!-- TOC --\u003e\n* [Multi-channel contexts](#multi-channel-contexts)\n  * [Setup](#setup)\n  * [Creating and using contexts](#creating-and-using-contexts)\n    * [Creating a context](#creating-a-context)\n    * [Using a context](#using-a-context)\n  * [Context types](#context-types)\n    * [Domain](#domain)\n      * [Domain matching](#domain-matching)\n    * [GET parameter](#get-parameter)\n    * [IP address](#ip-address)\n    * [HTTP header](#http-header)\n    * [Logical context combination](#logical-context-combination)\n  * [Fluid template implementation](#fluid-template-implementation)\n  * [TypoScript implementation](#typoscript-implementation)\n\u003c!-- TOC --\u003e\n\n\n## Setup\n1. Install and activate extension ``contexts``\n2. Clear TYPO3 cache\n\nOptional: Install extensions ``contexts_geolocation`` for location-based\ncontext rules (continent, country, area) and\n``contexts_wurfl`` for device-based rules\n(type check: phone, tablet, TV, ...; screen sizes, device/browser type).\n\n\n## Creating and using contexts\n\n### Creating a context\n1. Log into the TYPO3 backend as administrator\n2. Goto Web/List view, root page (ID 0)\n3. Create a new record: TYPO3 contexts -\u003e Context\n\n   - Give it a title, e.g. \"Affiliate ID: foo\"\n   - Select a type: \"GET parameter\"\n   - GET parameter name: ``affID``\n   - Parameter value: ``foo``\n   - Activate \"Store result in user session\"\n   - Save and close\n\n### Using a context\n1. Goto Web/Page, select a page\n2. Edit a content element\n3. Select the \"Contexts\" tab\n4. For Context \"Affiliate ID: foo\", select \"Visible: yes\"\n5. Save\n\nView the page. The content element is not visible.\n\nNow add ``?affID=foo`` to the URL and load it.\nThe content element will be visible now.\n\nYou can visit other pages now. When you come back, the content element\nwill still be visible - even though the GET parameter is not in the URL\nanymore - because \"Store result in user session\" had been activated.\n\n\n## Context types\nThe ``contexts`` extension ships with a number of simple contexts.\nAll of them get stored in table ``tx_contexts_contexts``.\n\n### Domain\nA domain context matches when the domain the user visits is in the\nconfigured list.\n\nThis is helpful if the site is available on several domains, or\nwhen it is deployed on development/stage/live systems - you may choose\nto show a content element on the development system only.\n\n#### Domain matching\nYou may use one domain per line.\n\nWhen the domain does not begin with a dot, it will only match fully:\n``www.example.org`` will not match the configured domain ``example.org``.\n\nIt is possible to use a dot in front of the domain name.\nIn this case, all subdomains will match:\n``some.www.example.org`` matches the configured domain ``.example.org``.\n\n\n### GET parameter\nChecks if a GET parameter is available and has a certain value.\n\nActivate \"Store result in user session\" to keep the context when navigating\nbetween pages.\n\nWhen leaving the parameter values field empty, any non-empty parameter value\nwill activate the context.\n\n\n### IP address\nMatches the user's IP address. IPv4 and IPv6 are supported.\n\nSupported notations:\n\n- Full addresses: ``80.76.201.32``\n- Prefix: ``80.76.201.32/27``, ``FE80::/16``\n- Wildcards: ``80.76.201.*``, ``80.76.*.37``, ``80.76.*.*``\n\n\n### HTTP header\nChecks if an HTTP header is available and has a certain value.\n\nActivate \"Store result in user session\" to keep the context when navigating\nbetween pages.\n\nWhen leaving the parameter values field empty, any non-empty parameter value\nwill activate the context.\n\n\n### Logical context combination\nCombines other contexts with logical operators.\n\nContexts are referenced via their alias and can be combined with\nthe following signs:\n\n- logical and: ``\u0026\u0026``\n- logical or: ``||``\n- negation: ``!``\n- parentheses to group parts of expressions: ``(...)``\n\n\n### Session variable\nThis context checks if a session variable with the given name is\nset (is not NULL).\n\n\n## Fluid template implementation\nThe implementation of a context query in fluid templates looks like::\n\n```html\n\u003cdiv xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:contexts=\"http://typo3.org/ns/Tx_Contexts_ViewHelpers\"\u003e\n    \u003cf:if condition=\"{contexts:matches(alias:'mobile')}\"\u003e\n        \u003cf:then\u003eis Mobile\u003c/f:then\u003e\n        \u003cf:else\u003eis not Mobile\u003c/f:else\u003e\n    \u003c/f:if\u003e\n\u003c/div\u003e\n```\n\n## TypoScript implementation\nThe implementation of a context query in TypoScript looks like::\n\n```typo3_typoscript\n[contextMatch(\"mobile\")]\n    # do something, it's a mobile browser\n[END]\n```\n\n\n\n# Testing\n```bash\ncomposer update\nvendor/bin/phpcs Classes/ --standard=PSR12\nvendor/bin/phpstan analyse --configuration phpstan.neon\nvendor/bin/rector --dry-run\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetresearch%2Ft3x-contexts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnetresearch%2Ft3x-contexts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetresearch%2Ft3x-contexts/lists"}