Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Emerging TypoScript Best Practices - InspiringC...
Search
Sebastian Kurfürst
April 23, 2016
Technology
280
3
Share
Emerging TypoScript Best Practices - InspiringCon 2016
This presentation has been held by Sebastian Kurfürst @InspiringCon 2016 in Kolbermoor.
Sebastian Kurfürst
April 23, 2016
More Decks by Sebastian Kurfürst
See All by Sebastian Kurfürst
How To Write Unmaintainable Code - PHPDD 2024
skurfuerst
0
110
How To Write Unmaintainable Code
skurfuerst
0
94
PHPDD23: Practical Debugging and Performance Profiling
skurfuerst
0
94
Neos Con 2023: Migrating a Project to Neos 9
skurfuerst
0
50
Neos Con 2022: The New Content Repository
skurfuerst
0
59
Neos Conference 2021: Event Sourced Content Repository - the current status
skurfuerst
0
60
2020: Sandstorm Technology Radar
skurfuerst
0
44
Neos Conference 2020: Event Sourced Content Repository - the current status
skurfuerst
0
37
Plone-Tagung Dresden 2020 - Patterns und Best Practices für die Entwicklung erweiterbarer und leistungsstarker React SPAs am Beispiel der Neos CMS-Benutzeroberfläche
skurfuerst
1
240
Other Decks in Technology
See All in Technology
そのSLO 99.9%、本当に必要ですか? 〜優先度付きSLOによる責任共有の設計思想〜 / Is that 99.9% SLO really necessary? Design philosophy of shared responsibility through prioritized SLOs
vtryo
0
420
10サービス以上のメール到達率改善を地道に継続的に進めている話 / Continue to improve email delivery rates across multiple services
yamaguchitk333
3
110
Vision Banana: Image Generators are Generalist Vision Learners
kzykmyzw
0
330
PdM・Eng・QAで進めるAI駆動開発の現在地/aidd-with-pdm-eng-qa
shota_kusaba
0
140
なぜ、私がCommunity Builderに?〜活動期間1か月半でも選出されたワケ〜
yama3133
0
110
ServiceによるKubernetes通信制御ーClusterIPを例に
miku01
1
160
ボトムアップの改善の火を灯し続けろ!〜支援現場で学んだ、消えないための3つの打ち手〜 / 20260509 Kazuki Mori
shift_evolve
PRO
2
600
アプリブロック機能のつくりかたと、AIとHTMLの不合理な相性の良さについて
kumamotone
1
220
サンプリングは「作る」のか「使う」のか? 分散トレースのコストと運用を両立する実践的戦略 / Why you need the tail sampling and why you don't want it
ymotongpoo
3
140
Claude Code / Codex / Kiro に AWS 権限を 渡すとき、何を設計すべきか
k_adachi_01
2
280
新卒エンジニア研修、ハンズオンの設計における課題と実践知/ #tachikawaany
nishiuma
2
140
"うちにはまだ早い"は本当? ─ 小さく始めるPlatform Engineering入門
harukasakihara
4
400
Featured
See All Featured
KATA
mclloyd
PRO
35
15k
Mobile First: as difficult as doing things right
swwweet
225
10k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
23k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
My Coaching Mixtape
mlcsv
0
120
How to Talk to Developers About Accessibility
jct
2
190
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4k
Heart Work Chapter 1 - Part 1
lfama
PRO
6
35k
How to build a perfect <img>
jonoalderson
1
5.5k
Git: the NoSQL Database
bkeepers
PRO
432
67k
Become a Pro
speakerdeck
PRO
31
5.9k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.9k
Transcript
Best Practices about TypoScript
Sebastian Kurfürst @skurfuerst
Emerging Best Practices about TypoScript
Why TypoScript?
http://www.sxc.hu/browse.phtml?f=view&id=956017 TypoScript as View Coordinator
Extensibility Planned Extensibility Unplanned Extensibility Supported during updates Own Risk
Planned Extensibility prototype(TYPO3.Neos:ContentCase) < prototype(TYPO3.TypoScript:Case) { default { @position =
'end' condition = TRUE type = ${q(node).property('_nodeType.name')} } }
Unplanned Extensibility # custom TypoScript prototype(TYPO3.Neos.NodeTypes:Image)
[email protected]
= false
# custom TypoScript prototype(TYPO3.Neos.NodeTypes:Image)
[email protected]
= false # Default definition of
Image TS Object prototype(TYPO3.Neos.NodeTypes:Image) { ...
[email protected]
= TYPO3.Neos:ConvertUris { forceConversion = true } } Dependency Ordering crucial!
Dependency Ordering crucial! TYPO3.Neos.NodeTypes My.Site # composer.json { "require": {
"typo3/neos-nodetypes": "*" } }
cat Configuration/PackageStates.php | grep composerName
None
Files and Folder Structure
• one TypoScript object per file • subfolders according to
your domain
Embrace TypoScript Prototypes
prototype(Acme:Slideshow) < prototype(TYPO3.Neos:Content) { .... } # Instantiation mySlideshow =
Acme:Slideshow
class Slideshow extends Content { } $mySlideshow = new Slideshow();
Explicit Names!
TypoScript prototypes for page objects page = Page { ....
} Old # COPY (bad!) specialPage < page { .... } root.special { condition = ${....} renderPath = '/specialPage' } prototype(Site:MyObject) < prototype(Page) { .... } page = Site:MyObject Recommended prototype(Site:Special) < prototype(Site:MyObject) { .... } root.special { condition = ${....} type = 'Site:Special' }
Composition vs Inheritance
MyTextWithImage MySpecialText Inheritance MyImage MyText
MyTextWithImage Composition MyImage MyText
Try to use composition!
How? prototype(MyTextWithImage) < prototype(TYPO3.Neos:Content) { image = MyImage { image
= ${q(node).property('image')} } ... same for text element }
One Content, Multiple Output Formats
prototype(TYPO3.Neos:ContentCase) < prototype(TYPO3.TypoScript:Case) { default { @position = 'end' condition
= TRUE type = ${q(node).property('_nodeType.name')} } }
prototype(Flowpack.SearchPlugin:SingleResult) < prototype(TYPO3.TypoScript:Case) { default { condition = Flowpack.SearchPlugin:CanRender {
type = ${node.nodeType.name + 'SearchResult'} } type = ${node.nodeType.name + 'SearchResult'} } fallback { condition = TRUE type = 'TYPO3.Neos:DocumentSearchResult' } } Product Product ProductSearchResult
Fluid vs TypoScript
TypoScript Fluid rendering controller extensible declarative no loops simple templates
imperative
<f:for each="{items}" as="item"> <li{ts:render(path:'{item.state}.attributes', context: {item: item}) -> f:format.raw()}> <neos:link.node
node="{item.node}">{item.label}</neos:link.node> <f:if condition="{item.subItems}"> <ul> <f:render section="itemsList" arguments="{items: item.subItems}" /> </ul> </f:if> </li> </f:for> Fine to use e.g. for menus!
None
The Content Cache
Page Menu ContentCollection Text Plugin Image cached embed embed embed
embed embed Page Cache Record
prototype(Page) { @cache { mode = 'cached' } }
Page Menu ContentCollection Text Plugin Image cached embed embed embed
embed embed Page Cache Record
Page Menu ContentCollection Text Plugin Image cached embed embed embed
cached embed Page Cache Record Plugin Cache Record
Page Menu ContentCollection Text Plugin Image cached embed embed embed
uncached embed Page Cache Record always rendered dynamically
cached uncached embedded part of outer cached element store in
cache render dynamically
Page Menu ContentCollection Text Plugin Image cached embed embed embed
uncached embed always rendered dynamically What is currently being rendered? What is in the (TypoScript) context?
What is currently being rendered? What is in the (TypoScript)
context? prototype(Page) { @cache { mode = 'uncached' context { 1 = 'node' 2 = 'documentNode' } } }
cached embedded part of outer cached element store in cache
uncached render dynamically
Basic Idea of caching Calculate Cache Entry Identifier Does Entry
Identifier Exist In Cache? expensive calculation (such as rendering a page) Page Cache Record store in cache e.g. URL
Configuring the Entry Identifier prototype(Page) { @cache { mode =
'cached' entryIdentifier { // parts of the entry identifier node = ${node} editPreviewMode = ${node.context.currentRenderingMode.name} } } }
Configuring the Entry Identifier prototype(Page) { @cache { mode =
'cached' entryIdentifier { // parts of the entry identifier fixedIdentifier = 'Hello World' } } }
Done!
There are only two hard things in Computer Science: cache
invalidation and naming things. -- Phil Karlton
Not Quite!
Core Question When should the cache be flushed?
When should the cache be flushed? Page Cache Record Everything
Node_A.B Everything Node_A.B DescendantOf_A NodeType_X
Confused?
Neos has sane defaults!
None
None
Existing Packages
Flowpack.Listable
None
Neos.MarketPlace neos.io
None
Neos.NeosIo
https://github.com/psmb/
TYPO3.Neos TYPO3.Neos.NodeTypes
Experiment, Share, Discuss, Iterate!
None