What is the best use of typoscript in fluid templates?

If I want to use typoscript as creating a menu in a liquid template, I have two possible ways:

  • use typoscript to populate the variable for the template. doing it as follows:

    page.10 = FLUIDTEMPLATE
    page.10 {
        templateName = index.html
        // ... define pathes ...
        variables {
            contentMain < styles.content.get
            mainMenu < temp.mainMenu
            :
        }
    }
    

    and in the template just use the variable:

    <div class="header">
        <div class="logo">{logo->f:format.raw()}</div>
        <div class="main-menu">{mainMenu->f:format.raw()}</div>
    </div> 
    
  • another way is to use the f: cObject viewer to invoke the typoscript part.
    typoscript:

    page.10 = FLUIDTEMPLATE
    page.10 {
        templateName = index.html
        // ... define pathes ...
        variables {
            contentMain < styles.content.get
            :
        }
    }
    lib.mainMenu < temp.mainMenu
    

    while the liquid pattern is as follows:

    <div class="header">
        <div class="logo">{logo->f:format.raw()}</div>
        <div class="main-menu">
            <f:cObject typoscriptObjectPath="lib.mainMenu />
        </div>
    </div> 
    

So. My question is: what are the pros and cons of each?
Are there differences for different versions of TYPO3?

+4
source share
2 answers

pgampe !

, , . , .

  • USER_INT , (). - , .
  • EXT: ExcludeDisplayedNews. , - ( ), , , .
+4

, .

, , cObject viewhelper.

, . , .

dataProcessors , . TYPO3 8.x LTS , . . #78672 ( TYPO3 8.5). - , . .

https://docs.typo3.org/typo3cms/extensions/core/8-dev/Changelog/8.5/Feature-78672-IntroduceFluidDataProcessorForMenus.html

+2

Source: https://habr.com/ru/post/1665419/


All Articles