I am using page.includeJSFooter
and need to add files when the page layout is set to a certain value.
I have tried using an if like this:
page.includeJSFooter {
file1 = myscript.js
file1.if.isFalse.field = layout
file1.if.isFalse.value = 103
file1.if.isFalse.negate = 1
}
I tried a few variations on that but can't get it to work?
your condition has some problems:
file1.if.isFalse.field = layout
you test if the field has no value (equality to boolean false like 0 or empty string)
file1.if.isFalse.value = 103
.isFalse
does not compare to any specific value
file1.if.isFalse.negate = 1
.negate
should occur one level higher and a negation of .isFalse
would be .isTrue
what you need is a compare to equality.
That would be as a simple solution something like this:
page.includeJSFooter {
file1 = myscript.js
file1.if.equals = 103
file1.if.value.field = layout
}
if you use the field backend_layout
you probably also use the field backend_layout_next_level
which may set values for pages below.
Then your TS would look like:
page.includeJSFooter {
file1 = myscript.js
file1.if {
equals {
data = levelfield:-1,backend_layout_next_level,slide
override.field = backend_layout
}
value = pagets__speciallayout
}
}
trying to get the layout from the inheriting field backend_layout_next_level
, but an explicit given value in the field backend_layout
has priority.