Daniel Siepmann - Coding is Art

Blog Posts

Topic: 9 LTS

TypoScript outside of Frontend context

Published: , Updated:

Tested with TYPO3: 11 LTS, 10 LTS, 9 LTS, 8 LTS

Topics: typo3, typoscript, extbase

TypoScript by concept is meant for frontend context only. There is TSconfig for backend as well. Extbase introduced a way to also configure backend modules via TypoScript. Nowadays TypoScript is also used in other context, e.g. scheduler tasks or commands.

I'll explain how the actual TypoScript is loaded, so you understand that part and can use it.

Prepare legacy code for upcoming TYPO3 versions

Published: , Updated:

Tested with TYPO3: 9 LTS, 8 LTS

Topics: typo3

Some of you, like one of our customers, are still on TYPO3 v8 or 9. We all dream of a bright future where we get shiny new features like new event handling by PSR-14, and dependency injection by PSR-11. Still we can write code that actually follows the new features and provides benefits today. Updates will become very smooth thanks to rector which could auto migrate everything necessary.

Read the following sections to get concrete examples on how we write code in 8.7 that will be auto migrated to 10.4 (11.x) via rector and how we profit today.

Video: PHPUnit Introduction

Published: , Updated:

Tested with TYPO3: 10 LTS, 9 LTS, 8 LTS

Topics: video, tutorial, testing

This is my very first video. It will introduce you to the beginning of PHPUnit to create unit tests for PHP Code.

The video includes instructions on how to install dependencies via composer, as well as how to write and execute first tests.

Execution is done on command line, as this should be the same on all environments.

Hidden TYPO3 gem EXT:feedit

Published: , Updated:

Tested with TYPO3: 10 LTS, 9 LTS

Topics: typo3

TYPO3 has hidden gems. One of them is the system extension feedit which adds frontend editing to TYPO3. It adds some options to the admin panel in TYPO3 frontend, and allows integrators to add more fine grained edit experience right into the content.

This post will cover most of the provided features, with screenshots and how to configure the extension. I'll also explain why I prefer the approach of EXT:feedit over extensions like EXT:frontend_editing.

TYPO3 Plugins as Content Elements

Published: , Updated:

Tested with TYPO3: 9 LTS, 8 LTS

Topics: typo3, typoscript, extbase

E.g. to add a simplified and project-specific News Extension Content element for backend editors.

You might think “I know what plugins, within TYPO3, are”. Maybe that’s true, maybe you will still learn something new.

This blog post will first explain what TYPO3 plugins are. But it will also explain how to define site specific plugins for existing installed 3rd party extensions, and why this might be useful.

TYPO3 content caching

Published: , Updated:

Tested with TYPO3: 11 LTS, 10 LTS, 9 LTS, 8 LTS

Topics: typo3, typoscript

TYPO3 provides a comprehensive caching implementation. Built into all parts of TYPO3. By default TYPO3 tries hard to provide a working caching solution for Websites. This way all generated content is cached whenever possible and delivered right from cache without rendering. This leads to some issues if dynamic content is added. Some bypass this issue by deactivating caching partly or for whole pages.

This post explains how to configure TYPO3 to make caching work without deactivating it. One place where caching does not work out of the box is changing files via Filelist module, changes there will not be reflected in content elements using a file reference. This example is used to explain how caching works in TYPO3 and how to adjust caching.

Configure page UIDs for all content elements in TYPO3

Published: , Updated:

Tested with TYPO3: 10 LTS, 9 LTS, 8 LTS

Topics: typo3, typoscript

TYPO3 uses pages to organise the structure of a website. This leads to situations where you have a specific page for a feature, e.g. a page “Search” containing the plugin to display search results. Or a page containing the profile of the currently logged in user. Typically links to these pages are scattered all over the website, e.g. within some content elements, inside the page layout like header and within some plugins.

This Blog post explains how to provide the page uid for a specific page, to all three kinds of “content”, where you typically need this information, with three lines of TypoScript.

How to use mbox with TYPO3 CMS

Published: , Updated:

Tested with TYPO3: 11 LTS, 10 LTS, 9 LTS, 8 LTS

Topics: typo3

From time to time you need to test some email within your TYPO3 installation. Whether it might be that you are a developer sending some mail via a CommandController or Plugin, or you are an integrator configuring EXT:powermail or EXT:form to deliver some mail.

In all cases you need to make sure this mail is not send to external addresses like your customer during development and testing. Also you need to be able to check the content of the mail. In this blog post you will learn what mbox is and how to use it.

Auto login for TYPO3 Backend during development

Published: , Updated:

Tested with TYPO3: 10 LTS, 9 LTS, 8 LTS

Topics: typo3

As an TYPO3 integrator or developer you will login into the same TYPO3 installations multiple times during the same day. There are different ways to prevent the need to login over and over again. One is to add a bit of PHP to the installation, e.g. inside AdditionalConfiguration.php to prevent any login. This should save a lot of time during development.

In this blog post this solution will be shown and explained. You will never ever have to login on your local installation anymore.

TYPO3 (Extbase) Injection

Published: , Updated:

Tested with TYPO3: 9 LTS, 8 LTS

Topics: typo3, extbase

TYPO3 provides a way of dependency injection. This way you do not need to resolve dependencies inside of your code, but the framework will resolve and provide the dependencies for you. This is provided by the framework Extbase, back ported of Flow.

The main benefit is the flexibility. Using Interfaces to define dependencies, instead of concrete classes, it’s possible to exchange injected dependencies just by configuring the framework. This way you can exchange classes in 3rd party code and receive a huge flexibility. Same goes for testing your code. In this Post I will show you the different ways to make use of dependency injection inside of TYPO3 and provide help for edge cases.

Build TYPO3 Language Menu without the need of optionSplit

Published: , Updated:

Tested with TYPO3: 9 LTS, 8 LTS

Topics: typo3, typoscript

TYPO3 CMS allows you to build a language menu to enable the frontend user to switch the current language. This menu is generated via TypoScript using optionSplit. Just start a query and take a look at the snippets. This way has one big drawback. In a multi domain setup you have to change the config

We have overcame this issue with one language menu working for all setup on all domains without the need to adjust anything. Read here how to achieve this.

How to find Hooks in TYPO3

Published: , Updated:

Tested with TYPO3: 9 LTS, 8 LTS

Topics: typo3

Hooks inside of TYPO3 CMS allow you to hook into existing processes of the core, or of extensions, to manipulate the processes.

This post will explain in more depth what hooks are and how you can find and use them.

TYPO3 Custom DevLog

Published: , Updated:

Tested with TYPO3: 9 LTS, 8 LTS

Topics: typo3

TYPO3 ships with a debugging process called DevLog. It’s a function provided by the core and used by many extensions. The main purpose is to log information for debugging. Beside the new Core feature Logging Framework, it’s older and therefore used in more extensions. TYPO3 doesn’t ship with a handler for this function, it’s possible to provide handler via TYPO3’s Events, Signals and Hooks mechanism and the popular devlog extension is installed on many TYPO3 installations to have a handler which logs everything to the database and provide a backend module to see the entries. But that’s not necessary, you can register your own, very small handler in your AdditionalConfiguration.php or your distribution.

Inject TypoScript Settings

Published: , Updated:

Tested with TYPO3: 9 LTS, 8 LTS

Topics: typo3

Sometimes you need settings like TypoScript in a class which is not your controller. Inside a controller, the Extbase framework already injects the settings for you, so you are able to access them under $this->settings.

In all other classes it’s easy to let Extbase inject the settings for you. Just include the following code, and make sure you instantiate the class via \TYPO3\CMS\Extbase\Object\ObjectManager instead of \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance().