

Uses the 1. template if in the right column is some content else the 2. one.
temp.maintemplate= COA temp.maintemplate { 10 = COA 10 { if.isTrue.numRows < styles.content.getRight 10 = TEMPLATE 10 { template = FILE template.file = fileadmin/templates/template-2column.html } } 20 = COA 20 { if.isFalse.numRows < styles.content.getRight 10 = TEMPLATE 10 { template = FILE template.file = fileadmin/templates/template.html } } }




styles.content.get = CONTENT
styles.content.get {
table = tt_content
select.orderBy = sorting
select.where = colPos=0
select.languageField = sys_language_uid
}
styles.content.getLeft < styles.content.get
styles.content.getLeft.select.where = colPos=1
styles.content.getRight < styles.content.get
styles.content.getRight.select.where = colPos=2
styles.content.getBorder < styles.content.get
styles.content.getBorder.select.where = colPos=3
I had to add this manually to the Typoscript and then it worked.
Using CSC will have previously defined what each of the styles.content.get are.
temp.resource = COA
temp.resource {
10 = COA
10 {
if.isTrue.numRows < styles.content.getRight
10 = TEMPLATE
10 {
template = FILE
template.file = fileadmin/tmpl/tmpl01.html
}
}
20 = COA
20 {
if.isFalse.numRows < styles.content.getRight
10 = TEMPLATE
10 {
template = FILE
template.file = fileadmin/tmpl/tmpl02.html
}
}
}
### Configuration of the auto template parser: ###
plugin.tx_automaketemplate_pi1 {
content < temp.resource
ifTrue.numRows < styles.content.getLeft
ifTrue.numRows < styles.content.getRight
and it ignores the first row. That's probably the expected behaviour but strange for a newbie like me.
The workaround was to use:
value = 0
ifGreaterThan.numRows < styles.content.getLeft
ifTrue.numRows < styles.content.getRight
(or .equals instead of repeated isFalse)
I need to load CSS file according to different conditions
(if left and normal columns are not empty)
(if right and normal columns are not empty)
(if left and right and normal columns are not empty)
is it possible to make such complex conditions using typoscript?
- Only normal coluomn
- Left and Normal
- Right and normal
- Left, Normal and Right
Normal coloumn resizes to fit in the area. CSS futher down.
lib.contentMain= COA
lib.contentMain{
# Wraps maincontent in CSS style "main_alt1" if there is content in Right but not in Left
10 = COA
10.wrap = <div id="main_alt1"> | </div>
10 {
if.isTrue.numRows < styles.content.getLeft
if.isFalse.numRows < styles.content.getRight
10 = CONTENT
10 < styles.content.get
}
# Wraps maincontent in CSS style "main_alt2" if there is content in Left but not in Right
20 = COA
20.wrap = <div id ="main_alt2"> | </div>
20 {
if.isTrue.numRows < styles.content.getRight
if.isFalse.numRows < styles.content.getLeft
10 = CONTENT
10 < styles.content.get
}
# Wraps maincontent in CSS style "main_alt3" if there is NO content in Right or Left.
30 = COA
30 {
if.isFalse.numRows < styles.content.getLeft
10 = COA
10.wrap = <div id="main_alt3"> | </div>
10 {
if.isFalse.numRows < styles.content.getRight
10 = CONTENT
10 < styles.content.get
}
}
# Wraps maincontent in CSS style "main_alt4" if there IS content in Right and Left.
40 = COA
40 {
if.isTrue.numRows < styles.content.getLeft
10 = COA
10.wrap = <div id="main_alt4"> | </div>
10 {
if.isTrue.numRows < styles.content.getRight
10 = CONTENT
10 < styles.content.get
}
}
}
Everything is wraped inside a div id="content" with a fixed width so the other content can float relative to it.
#content{
position: relative;
width: 900px;
margin-left: auto;
margin-right: auto;
}
#main_alt1{
width: 700px;
float: right;
}
#main_alt2{
width: 700px;
float: left;
}
#main_alt3{
clear: both;
}
#main_alt4{
width: 520px;
float: left;
margin-left: 6px;
}
#left{
float: left;
width: 180px;
}
#right{
float: right;
width: 180px;
}
#border{
border: 1px solid #444;
position: absolute;
top: 0px;
right: 0px;
}
Add comment