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 - InspiringCon 2016
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
PHPDD23: Practical Debugging and Performance Profiling
skurfuerst
0
37
Neos Con 2023: Migrating a Project to Neos 9
skurfuerst
0
13
Neos Con 2022: The New Content Repository
skurfuerst
0
12
Neos Conference 2021: Event Sourced Content Repository - the current status
skurfuerst
0
9
2020: Sandstorm Technology Radar
skurfuerst
0
4
Neos Conference 2020: Event Sourced Content Repository - the current status
skurfuerst
0
5
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
150
Neos Conference 2019: Announcing the Event Sourced Content Repository Alpha 1
skurfuerst
0
42
Neos Conference 2019: Neos + CKEditor 5 = Love
skurfuerst
0
60
Other Decks in Technology
See All in Technology
Java EE/Jakarta EEの現状と将来―クラウドネイティブ時代にJava EEは対応できるのか?―
takakiyo
1
170
プロトタイピングによる不確実性の低減 / Reducing Uncertainty through Prototyping
ohbarye
5
390
LayerXにおけるLLMプロダクト開発の今までとこれから
layerx
PRO
1
400
ゼロから始めるVue.jsコミュニティ貢献 / first-vuejs-community-contribution-link-and-motivation
lmi
1
130
ServiceNow Knowledge Learning Rise up
manarobot
0
210
ChatGPT for IT Service Management (IT Pro)
dahatake
7
1.6k
「スニダン」開発組織の構造に込めた意図 ~組織作りはパッションや政治ではない!~
rinchsan
3
570
ServiceNow Knowledge 24の歩き方 EYストラテジー・アンド・コンサルティング
manarobot
0
200
よく聞くけど使ったことないソフトウェアNo.1 KafkaとSnowflake
foursue
4
360
Delivering Millions of Messages within seconds @ Duolingo
pelelgrino
0
350
IaCジェネレーターとBedrockで詳細設計書を生成してみた
tsukasa_ishimaru
2
280
MLOpsの「壁」を乗り越える、LINEヤフーの Data Quality as Code
lycorptech_jp
PRO
5
540
Featured
See All Featured
Stop Working from a Prison Cell
hatefulcrawdad
266
19k
Bootstrapping a Software Product
garrettdimon
PRO
302
110k
Designing Experiences People Love
moore
136
23k
Design by the Numbers
sachag
274
18k
Web Components: a chance to create the future
zenorocha
305
41k
Designing on Purpose - Digital PM Summit 2013
jponch
110
6.5k
Keith and Marios Guide to Fast Websites
keithpitt
408
22k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
25
2.3k
Building a Scalable Design System with Sketch
lauravandoore
456
32k
Principles of Awesome APIs and How to Build Them.
keavy
121
16k
Visualization
eitanlees
136
14k
What’s in a name? Adding method to the madness
productmarketing
PRO
16
2.6k
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