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
120
How To Write Unmaintainable Code
skurfuerst
0
100
PHPDD23: Practical Debugging and Performance Profiling
skurfuerst
0
100
Neos Con 2023: Migrating a Project to Neos 9
skurfuerst
0
52
Neos Con 2022: The New Content Repository
skurfuerst
0
63
Neos Conference 2021: Event Sourced Content Repository - the current status
skurfuerst
0
64
2020: Sandstorm Technology Radar
skurfuerst
0
49
Neos Conference 2020: Event Sourced Content Repository - the current status
skurfuerst
0
38
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
Platform Engineering as a Product: Criteria for Improvement and Multi-Tenant Design
kumorn5s
0
400
ポスター発表&デモと総括 / Poster Presentations & Demonstrations and Summary
ks91
PRO
0
170
海外カンファレンス「JavaOne」参加レポート ユーザー系IT企業における目的・成果/JavaOne Report Purpose and Results in the User IT Company
muit
0
110
OpenClawとHermesAgentでAI新入社員を作った話
takanoriyanada
0
140
AI駆動開発でなんでもハンズオン環境をつくってみた
yoshimi0227
0
180
電子辞書Brainをネットに繋げてみた(自力編)
raspython3
0
320
食べログのサーキットブレーカー導入を振り返って
atpons
1
150
自称宇宙最速で不合格となったAIP-C01にリベンジを果たすべくAIで問題集アプリを作ってみた。
yama3133
0
240
Java正規表現エンジン(NFA)の仕組みと パフォーマンスを維持するための最適化手法
takeuchi_132917
0
150
AIガバナンス実践 - 生成AIコネクタのデータ漏洩リスクと実務対策
knishioka
0
140
シンデレラなんかになりたくない!ガラスの靴が割れた時代にどう歩く?
nomizone
0
220
Terraformモジュールは、なぜ「魔境」化するのか
hayama17
1
120
Featured
See All Featured
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.9k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.2k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
300
The Cost Of JavaScript in 2023
addyosmani
55
10k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
1
3.6k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.3k
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
120
The Pragmatic Product Professional
lauravandoore
37
7.3k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
190
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
270
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.6k
The agentic SEO stack - context over prompts
schlessera
0
790
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