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.
Do I interpret this correctly? What is the correct, perf-efficient way to do this? Or is it a bug?