[TYPO3-english] How to choose frontend template based on be_layout for good performance

Urs Braem info at ursbraem.ch
Mon Nov 24 18:57:33 CET 2014


Disclaimer: This is a "duplicate" of http://stackoverflow.com/questions/27089334/with-typo3-be-layout-how-to-choose-frontend-template-correctly-performance-wis :-)

In most of my sites, I've been using the following code to decide which template should be applied to the content rendering - based on what the editor has picked in be_layout:

page.10 = TEMPLATE
page.10 {
    stdWrap.if {
       value = 1
       isInList.data = levelfield:-1,backend_layout_next_level,slide
       isInList.override.data = TSFE:page|backend_layout
    }
    template = FILE
    template.file = fileadmin/templates/main/tmpl/main.html
    ...
}
page.20 = TEMPLATE
page.20 {
    stdWrap.if {
       value = 2
       isInList.data = levelfield:-1,backend_layout_next_level,slide
       isInList.override.data = TSFE:page|backend_layout
    }
    template = FILE
    template.file = fileadmin/templates/main/tmpl/special.html
    ...
}
This works perfectly well.

But I had expected that the if condition would make sure that unnecessary page objects are not processed at at all. Until I've been looking into some performance issues via the admin panel: I discovered that both (all) child objects of page. seem to be rendered - even when the if condition doesn't apply.

It looks like it's processed regularly, and then simply not displayed! So the page rendering time explodes when using multiple templates.

see http://i.stack.imgur.com/YPeZ7.jpg

Do I interpret this correctly? What is the correct, perf-efficient way to do this? Or is it a bug?


More information about the TYPO3-english mailing list