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
3
240
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
Tweet
Share
More Decks by Sebastian Kurfürst
See All by Sebastian Kurfürst
How To Write Unmaintainable Code - PHPDD 2024
skurfuerst
0
18
How To Write Unmaintainable Code
skurfuerst
0
32
PHPDD23: Practical Debugging and Performance Profiling
skurfuerst
0
55
Neos Con 2023: Migrating a Project to Neos 9
skurfuerst
0
24
Neos Con 2022: The New Content Repository
skurfuerst
0
23
Neos Conference 2021: Event Sourced Content Repository - the current status
skurfuerst
0
26
2020: Sandstorm Technology Radar
skurfuerst
0
8
Neos Conference 2020: Event Sourced Content Repository - the current status
skurfuerst
0
14
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
170
Other Decks in Technology
See All in Technology
1等無人航空機操縦士一発試験 合格までの道のり ドローンミートアップ@大阪 2024/12/18
excdinc
0
180
組織に自動テストを書く文化を根付かせる戦略(2024冬版) / Building Automated Test Culture 2024 Winter Edition
twada
PRO
18
5.6k
10個のフィルタをAXI4-Streamでつなげてみた
marsee101
0
180
AWS re:Invent 2024で発表された コードを書く開発者向け機能について
maruto
0
210
LINE Developersプロダクト(LIFF/LINE Login)におけるフロントエンド開発
lycorptech_jp
PRO
0
150
Opcodeを読んでいたら何故かphp-srcを読んでいた話
murashotaro
0
320
プロダクト開発を加速させるためのQA文化の築き方 / How to build QA culture to accelerate product development
mii3king
1
290
効率的な技術組織が作れる!書籍『チームトポロジー』要点まとめ
iwamot
1
110
PHPerのための計算量入門/Complexity101 for PHPer
hanhan1978
5
680
ずっと昔に Star をつけたはずの思い出せない GitHub リポジトリを見つけたい!
rokuosan
0
160
DUSt3R, MASt3R, MASt3R-SfM にみる3D基盤モデル
spatial_ai_network
2
270
2024年にチャレンジしたことを振り返るぞ
mitchan
0
150
Featured
See All Featured
Making Projects Easy
brettharned
116
6k
Visualization
eitanlees
146
15k
Rails Girls Zürich Keynote
gr2m
94
13k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
The World Runs on Bad Software
bkeepers
PRO
66
11k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
180
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.9k
Intergalactic Javascript Robots from Outer Space
tanoku
270
27k
Java REST API Framework Comparison - PWX 2021
mraible
28
8.3k
[RailsConf 2023] Rails as a piece of cake
palkan
53
5.1k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.2k
It's Worth the Effort
3n
183
28k
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