Skip to content

Instantly share code, notes, and snippets.

View cepheiVV's full-sized avatar

Patrick Crausaz cepheiVV

View GitHub Profile
@eliashaeussler
eliashaeussler / query_page_tree.sql
Created August 7, 2023 14:47
Query TYPO3 page tree with MySQL 8+
set @rootPageId := 15047;
set @maxDepth := 99;
with recursive children as (
select root.*, 1 as depth
from pages root
where root.uid = @rootPageId
or (root.sys_language_uid > 0 and root.l10n_source = @rootPageId)
and root.deleted = 0
union all
@einpraegsam
einpraegsam / SiteFactory.php
Last active June 10, 2022 13:42
What can you do with SiteConfiguration in TYPO3 and how to get a site object from anywhere?
<?php
declare(strict_types=1);
namespace Vendor\Extension\Factory;
use GuzzleHttp\Psr7\Uri;
use TYPO3\CMS\Core\Exception\SiteNotFoundException;
use TYPO3\CMS\Core\Http\Request;
use TYPO3\CMS\Core\Http\ServerRequest;
use TYPO3\CMS\Core\Routing\SiteMatcher;
use TYPO3\CMS\Core\Site\Entity\Site;
@Gong-Bao-Chicken
Gong-Bao-Chicken / 0020_plugin.indexedsearch.ts
Last active September 9, 2020 08:47
How to Create a (global) Search Box for Typo3 7,8 and probably 9
plugin.tx_indexedsearch {
show {
rules=0
}
settings {
targetPid = YOURPID
displayRules = 0
exactCount = 1
@vlucas
vlucas / encryption.js
Last active June 7, 2024 04:27
Stronger Encryption and Decryption in Node.js
'use strict';
const crypto = require('crypto');
const ENCRYPTION_KEY = process.env.ENCRYPTION_KEY; // Must be 256 bits (32 characters)
const IV_LENGTH = 16; // For AES, this is always 16
function encrypt(text) {
let iv = crypto.randomBytes(IV_LENGTH);
let cipher = crypto.createCipheriv('aes-256-cbc', Buffer.from(ENCRYPTION_KEY), iv);
@BlackhawkG7
BlackhawkG7 / TYPO3 PageTree
Last active November 2, 2023 14:52
Get 10 levels of the tree recursively starting at $pid | TYPO3 // extbase
// get 10 levels of the tree recursively starting at $pid
$pid = intVal($_GET['id']);
$queryGenerator = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Database\\QueryGenerator');
$pidList = $queryGenerator->getTreeList($pid, 10, 0, 1);
$pids = explode(',',$pidList);
@georgringer
georgringer / Gridelements Configuration
Last active August 7, 2020 09:07
TYPO3 Gridelements, configuration by files without any database involvement
# Page TSConfig:
tx_gridelements.setup {
# Identifier
2col {
title = 2 Spalten
config {
colCount = 2
rowCount = 1
rows {
1 {