Emerging TypoScript Best Practices - InspiringCon 2016

Emerging TypoScript Best Practices - InspiringCon 2016

This presentation has been held by Sebastian Kurfürst @InspiringCon 2016 in Kolbermoor.

30c0b6f50f67163bee8500aa4115d126?s=128

Sebastian Kurfürst

April 23, 2016
Tweet

Transcript

  1. 7.
  2. 9.

    # custom TypoScript prototype(TYPO3.Neos.NodeTypes:Image).link.@process.convertUris.forceConversion = false # Default definition of

    Image TS Object
 prototype(TYPO3.Neos.NodeTypes:Image) {
 ... link.@process.convertUris = TYPO3.Neos:ConvertUris {
 forceConversion = true
 }
 } Dependency Ordering crucial!
  3. 12.
  4. 19.

    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' }
  5. 24.

    How? prototype(MyTextWithImage) < prototype(TYPO3.Neos:Content) { image = MyImage { image

    = ${q(node).property('image')} } ... same for text element }
  6. 27.

    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
  7. 30.

    <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!
  8. 31.
  9. 36.

    Page Menu ContentCollection Text Plugin Image cached embed embed embed

    cached embed Page Cache Record Plugin Cache Record
  10. 37.

    Page Menu ContentCollection Text Plugin Image cached embed embed embed

    uncached embed Page Cache Record always rendered dynamically
  11. 39.

    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?
  12. 40.

    What is currently being rendered? What is in the (TypoScript)

    context? prototype(Page) { @cache { mode = 'uncached' context { 1 = 'node' 2 = 'documentNode' } } }
  13. 42.

    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
  14. 43.

    Configuring the Entry Identifier prototype(Page) { @cache { mode =

    'cached' entryIdentifier { // parts of the entry identifier node = ${node} editPreviewMode = ${node.context.currentRenderingMode.name} } } }
  15. 44.

    Configuring the Entry Identifier prototype(Page) { @cache { mode =

    'cached' entryIdentifier { // parts of the entry identifier fixedIdentifier = 'Hello World' } } }
  16. 45.
  17. 46.

    There are only two hard things in Computer Science: cache

    invalidation and naming things. -- Phil Karlton
  18. 49.

    When should the cache be flushed? Page Cache Record Everything

    Node_A.B Everything Node_A.B DescendantOf_A NodeType_X
  19. 50.
  20. 52.
  21. 53.
  22. 56.
  23. 58.
  24. 63.