[TYPO3] CASE treats field values as TS - is this desired?
Sacha Vorbeck
info at unlimited-vision.net
Tue Feb 7 12:24:04 CET 2006
Hi,
probably I get something wrong but I think CASE is not handling strings
correctly.
The story:
I have a site that uses the templateselector. Besides my standard
template I have two additional templates called
twocolumn.htm
and
threecolumn.htm
When a user selects a template, an appropriate stylesheet should be
included. Therefore I added the field tx_rlmptmplselector_main_tmpl to
the rootline fields and use its value to decide which stylesheet to include:
page = PAGE
page {
headerData.5 = COA
headerData.5 {
40 = CASE
40 {
key.data = levelfield : -1 , tx_rlmptmplselector_main_tmpl , slide
twocols.htm = TEXT
twocols.htm {
value (
<style type="text/css">
@import "twocols.css";
</style>
)
}
threecols.htm = TEXT
threecols.htm {
value (
<style type="text/css">
@import "threecols.css";
</style>
)
}
default = TEXT
default {
value (
<style type="text/css">
@import "normal.css";
</style>
)
}
}
}
}
This doesn`t work because the TS parser thinks that .htm is a property
of twocols and doesn`t regard twocols.htm as a string to compare with
the field value.
My workaround was to use substring:
temp.selectedTemplate = COA
temp.selectedTemplate {
10 = TEXT
10 {
data = levelfield : -1 , tx_rlmptmplselector_main_tmpl , slide
substring = 0,-4
}
}
And then use the substring-ed value in the CASE object:
40 = CASE
40 {
key < temp.selectedTemplate
twocols = TEXT
twocols {
value (
<style type="text/css">
@import "twocols.css";
</style>
)
}
threecols = TEXT
threecols {
value (
<style type="text/css">
@import "threecols.css";
</style>
)
}
default = TEXT
default {
value (
<style type="text/css">
@import "normal.css";
</style>
)
}
}
This works but I`m still wondering if it is correct or makes sense that
CASE treats the string values as TS-objects.
Any comments?
--
thank you - all the best,
Sacha
More information about the TYPO3-english
mailing list