I want to set a class and a style attribute in the Body-Tag. But only if a Constant is set.
Constant:
page.theme.bodybackgroundpicture = fileadmin/pageBackground.png
Setup:
temp.body = COA
temp.body {
10 = TEXT
10.value = {$page.theme.bodybackgroundpicture}
10.stdWrap.wrap = <body class="background" style="background-image: url(|)">
10.stdWrap.wrap.override = <body>
10.stdWrap.wrap.override.ifEmpty = {$page.theme.bodybackgroundpicture}
}
page.bodyTagCObject < temp.body
It should be
<body class="background" style="background-image: url(fileadmin/pageBackground.png)">
or if constant is empty
<body>
But this don't work, where is my Error? Can anybody help me? Thank you
It won't work because the .wrap part is always a string and not of type stdWrap itself, so it has no override propery. You could create two objects with different if conditions like that
temp.body = COA
temp.body {
10 = TEXT
10.value = {$page.theme.bodybackgroundpicture}
10.stdWrap.wrap = <body class="background" style="background-image: url(|)">
10.if.isTrue = {$page.theme.bodybackgroundpicture}
20 = TEXT
20.value = <body>
20.if.isFalse = {$page.theme.bodybackgroundpicture}
}
This should also work:
10.value = <body class="background" style="background-image: url({$page.theme.bodybackgroundpicture})">
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.