Skip to content

Instantly share code, notes, and snippets.

@jrenggli
jrenggli / AdditionalConfiguration.php
Created December 16, 2015 21:26
pageNotFound_handling for restricted pages in TYPO3
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling'] = 'USER_FUNCTION:EXT:usermytemplate/Classes/Utility/PageNotFoundHandling.php:user_pageNotFound->pageNotFound';
// Custom configuration for multi-language 404 page, see EXT:usermytemplate/Classes/Utility/PageNotFoundHandling.php
// ID of the page to redirect to if page was not found
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling_redirectPageID'] = 123;
// ID of the page to redirect to if current page is access protected
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling_loginPageID'] = 789;
@Merec
Merec / PageLayoutView.php
Last active September 16, 2021 08:55 — forked from uberboom/PageLayoutView.php
TYPO3: Render a backend preview of custom content elements (TYPO3 CMS 6.2)
<?php
namespace Your\Extension\Namespace\Hooks;
class PageLayoutView implements \TYPO3\CMS\Backend\View\PageLayoutViewDrawItemHookInterface
{
/**
* Preprocesses the preview rendering of a content element.
*
@paulirish
paulirish / what-forces-layout.md
Last active August 11, 2025 02:26
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@oliverthiele
oliverthiele / robots.txt
Last active November 23, 2023 18:18
robots.txt for TYPO3
User-agent: *
# Only allow URLs generated with RealURL
Disallow: /*?id=*
Disallow: /*&id=*
# L=0 is the default language
Disallow: /*?L=0*
Disallow: /*&L=0*
@wolffc
wolffc / extabase_in_controller_action_validation_example.php
Created May 7, 2015 07:34
This is an TYPO3 / Extbase Example on how to Validate some Properties in the Controller - this is usefull for conditonal Validation
<?php
class foo {
/**
* keep trac if we have created a custom error.
* @var boolean
*/
protected $hasCustomError = false;
@cedricziel
cedricziel / ext_tables.php
Created May 4, 2015 20:47
Add a custom doktype to TYPO3 pages table
<?php
/**
* Custom Doktypes
*/
// Define a new doktype
$customShortlinkDoktype = 120;
$customPageIcon = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath($_EXTKEY) . 'Resources/Public/Icons/Shortlink.png';
// Add the new doktype to the list of page types
$GLOBALS['PAGES_TYPES'][$customShortlinkDoktype] = array(
@a-r-m-i-n
a-r-m-i-n / _realurl_domain_language_mapping.md
Last active September 1, 2017 09:45
RealURL Configuration for Domain == Language

This config shows an example of TYPO3 RealURL configuration, to map languages to domains.

Lets say the default language (L=0) is german and the foreign language is english (L=1). Normally RealURL would create links like that:

This example is about getting rid of the /en path segment.

@cedricziel
cedricziel / BookingPageOneValidator.php
Created April 17, 2015 07:16
Dynamic Validation on controller level
<?php
namespace Websight\MyExt\Validation;
/***************************************************************
* Copyright notice
*
* (c) 2015 Cedric Ziel <[email protected]>
* (c) 2014 Carsten Bleicker <[email protected]>
* All rights reserved
@htuscher
htuscher / AdditionalConfiguration.php
Last active March 26, 2018 20:00
TYPO3 Multitree without domain records in development
<?php
use TYPO3\CMS\Core\Utility\GeneralUtility;
if (\TYPO3\CMS\Core\Core\Bootstrap::getInstance()->getApplicationContext()->isDevelopment()) {
/**
* This override adds the possibility to use multitree subdomains without domain records (for SHARED_DB, vagrant, etc.)
* You can override the mappings or undo the override by creating a config file inside conf.d
*
* The override PageRepository checks for $subdomain . exec('hostname -f')
@kraftb
kraftb / README.md
Last active October 19, 2022 14:25
Completely clear the cache of a TYPO3 instance (filesystem, database)

Script for clearing all TYPO3 caches

This script aims to clear all (yes. really all) caches being used by TYPO3. So the file caches in typo3temp and typo3conf/autoload, next the database caches in tables cf_* and eventual realurl caches. And finally any PHP caches like those from APC, xcache, or other PHP accelerators/compilers.

Simply install the script at some executable location on your webserver