Skip to content

Instantly share code, notes, and snippets.

View hlubek's full-sized avatar

Christopher Hlubek hlubek

View GitHub Profile
@hlubek
hlubek / gist:7889386
Created December 10, 2013 11:45
TypoScript 2 guide

Hitchhikers guide to TypoScript 2

The old days

Do you remember the good old days?

What is TypoScript? Various myths and speculations exist about that, well, programming language? No, it never was a programming language. Though it could be used to express logic. Is it a configuration language then? It's often used to configure settings, but the scope is certainly blurry.

The power of TypoScript - if used well - is the declarative approach of expressing the rendering and execution of various parts of the system. And a declaration in TypoScript is never final, but can be changed at a later time by another extension or template.

@hlubek
hlubek / gist:7974434
Created December 15, 2013 15:39
TYPO3 Neos manual migration for homepage shortcut
START TRANSACTION;
DELETE FROM `typo3_typo3cr_domain_model_nodedata` WHERE path = '/sites/neostypo3org';
UPDATE `typo3_typo3cr_domain_model_nodedata` SET path = REPLACE(path, '/sites/neostypo3org/homepage', '/sites/neostypo3org'), pathhash = MD5(REPLACE(path, '/sites/neostypo3org/homepage', '/sites/neostypo3org')), parentpath = REPLACE(parentpath, '/sites/neostypo3org/homepage', '/sites/neostypo3org') WHERE path LIKE '/sites/neostypo3org/homepage%';
UPDATE typo3_typo3cr_domain_model_nodedata SET parentpath = '/sites' WHERE path = '/sites/neostypo3org';
COMMIT;
# Clear routing cache after that!
@hlubek
hlubek / gist:8055713
Last active December 31, 2015 22:49 — forked from sorenmalling/gist:8052896
prototype(Acme.Demo:IncludeCss) < prototype(TYPO3.TypoScript:Tag) {
tagName = 'link'
attributes {
type = 'text/css'
rel = 'stylesheet'
href = TYPO3.TypoScript:ResourceUri
}
}
page = Page {
@hlubek
hlubek / gist:8417301
Created January 14, 2014 12:05
Example of getting the best matching locale from multiple nodes using a group query (idea from http://explainextended.com/2009/11/24/mysql-selecting-records-holding-group-wise-maximum-on-a-unique-column/)
SELECT ni.*
FROM (
SELECT identifier, MIN(FIND_IN_SET(locale, 'en_US,en_ZZ,mul_ZZ')) AS localePos FROM `typo3_typo3cr_domain_model_nodedata` n WHERE `parentpath` = "/sites/neosdemotypo3/subpage/main" AND locale IN ('en_US', 'en_ZZ', 'mul_ZZ') GROUP BY identifier ORDER BY `sortingindex`
) nn
JOIN typo3_typo3cr_domain_model_nodedata ni
ON ni.identifier = nn.identifier AND FIND_IN_SET(ni.locale, 'en_US,en_ZZ,mul_ZZ') = nn.localePos
@hlubek
hlubek / gist:9123887
Created February 20, 2014 21:45
TypoScript content cache beard.json
{
"defaults": {
"gerrit_api_endpoint": "https://review.typo3.org/",
"gerrit_git": "git.typo3.org"
},
"changes": [
{
"name": "[FEATURE] Allow conversion from objects to simple types",
"type": "gerrit",
"path": "Packages/Framework/TYPO3.Flow",
@hlubek
hlubek / Settings.yaml
Last active August 29, 2015 13:57 — forked from aertmann/Settings.yaml
TYPO3:
Neos:
contentDimensions:
dimensions:
'locales':
defaultPreset: 'all'
label: 'Locale'
icon: 'icon-language'
presets:
'all':
@hlubek
hlubek / MultiColumn.ts2
Last active August 29, 2015 13:57
MultiColumn Bootstrap
#
# Adapt MultiColumn rendering to Bootstrap
#
prototype(TYPO3.Neos.NodeTypes:MultiColumn) {
attributes.class = ${'row-fluid columns-' + q(node).property('layout')}
columns.iterationName = 'iterator'
}
prototype(TYPO3.Neos.NodeTypes:MultiColumn) {
@override {
columnLayout = ${q(node).property('layout')}
@hlubek
hlubek / Root.ts2
Created April 5, 2014 19:15
Overriding the root default matcher to render document types with a prototype of the same name.
# Override the default root matcher to render a document node with a prototype of the same name
root.default {
type = ${q(node).property('_nodeType')}
renderPath >
}
#
# A blog Post document node renderer
#

Keybase proof

I hereby claim:

  • I am hlubek on github.
  • I am hlubek (https://keybase.io/hlubek) on keybase.
  • I have a public key whose fingerprint is 07C3 2231 EE93 14EB 9BAF 8562 968C 0CAB A521 36D6

To claim this, I am signing this object:

@hlubek
hlubek / gist:c552c45e0bf1b83e1bd1
Created September 1, 2014 11:41
TYPO3 Neos: Add a JavaScript include from another package
// Extend the Page prototype
prototype(TYPO3.Neos.NodeTypes:Page) {
// body or head depending on the position
body.javascripts {
prism = TYPO3.TypoScript:Tag {
tagName = 'script'
attributes {
src = TYPO3.TypoScript:ResourceUri {
path = 'resource://Networkteam.LearnNeos/Public/Scripts/Vendor/prism.js'
}