Sometimes I need to have nested (AND) if statements in typoscript. I often try using the following:
10 = TEXT
10.value = Foo Bar
10.if.value = Foo
10.if.equals = Foo
10.if.isTrue.if.value = Bar
10.if.isTrue.if.equals = Bar
Which will fail to work at all. Why? The nested if must return something for the isTrue to work, so adding the line:
10.if.isTrue.wrap = 1
will fix the problem.
Monday, 20 August 2012
Thursday, 16 August 2012
Custom content split issue
I occasionally run into an issue when trying to use a split on a custom generated CONTENT object.
Have a look at this code:
page.10 = COA_INT
page.10 {
10 < temp.groups
10.stdWrap.split {
token = ###SPLITTER###
cObjNum = 1
1 = TEXT
1.current = 1
}
}
You would expect the above code to strip the ###SPLITTER### tags out, but it doesn't. Why not? I've set the renderObj of the CONTENT to COA_INT, which causes the split to fail. Changing the renderObj to just COA fixes the problem. I'm not actually sure why, I haven't looked at the source, but I'm assuming it's something to do with the order in which the CONTENT object is processed when no caching is set.
Have a look at this code:
temp.groups = CONTENT
temp.groups {
table = fe_groups
select {
pidInList = {$groupStoragePid}
andWhere.dataWrap = FIND_IN_SET(uid, "{TSFE:fe_user|user|usergroup}")
}
renderObj = COA_INT
renderObj {
10 = TEXT
10.dataWrap = "{field:title}"###SPLITTER###
}
}
page.10 = COA_INT
page.10 {
10 < temp.groups
10.stdWrap.split {
token = ###SPLITTER###
cObjNum = 1
1 = TEXT
1.current = 1
}
}
You would expect the above code to strip the ###SPLITTER### tags out, but it doesn't. Why not? I've set the renderObj of the CONTENT to COA_INT, which causes the split to fail. Changing the renderObj to just COA fixes the problem. I'm not actually sure why, I haven't looked at the source, but I'm assuming it's something to do with the order in which the CONTENT object is processed when no caching is set.
Labels:
stdWrap,
TYPO3,
typoscript
Subscribe to:
Posts (Atom)