[TYPO3] wrap a COA using 'optionSplit'?
JoH
info at cybercraft.de
Wed Apr 19 19:55:30 CEST 2006
>>>lib.stdheader {
>>>stdWrap.split.dataWrap = <div class="csc-header
>>>csc-header-n{cObj:parentRecordNumber}"> <table cellspacing="0"
>>>cellpadding="0" border="0" width="100%"
>>>style="margin:0"><tr><td><h1{register:headerStyle}{register:headerClass}>|</h1></td><td
>>>align="right" class="printLink"><a class="printLink"
>>>href="javascript:window.print()"><img
>>>src="fileadmin/template/main/kuvat_catella/printer.gif"></a></td></tr></table></div>
>>>|*| <div class="csc-header csc-header-n{cObj:parentRecordNumber}">
>>>|</div> |*|<div class="csc-header csc-header-n{cObj:parentRecordNumber}">
>>>|</div>
>>>}
>>>
>>>
>>>seems not to work
>
>> Of course not since there is no split function, no token and nothing else
>> that would be necessary to use a split function here.
>> And I really don't know, what you are going to acchieve by optionSplit in
>> this case.
>
> the first header in a column should have special dataWrap (in fact only in
> colPos=0 but that would need extra conditions - some kind of
> CASE-structure)
OK - but the code you are wrapping around your header seems to be a bit
"oversized" if you just want a print link.
optionSplit doesn't make any sense here, since the whole header setup is
copied into the renderObj of a CONTENT element.
So you would have to use split and optionSplit on the CONTENT element, which
would be extremely complicated.
Here is a code that I would use to get the same result.
lib.stdheader = COA
lib.stdheader {
stdWrap.dataWrap >
stdWrap.outerWrap.cObject = CASE
stdWrap.outerWrap.cObject {
key.field = colPos
default = COA
default {
10 = COA
10 {
10 = TEXT
10.value = |
20 = IMAGE
20 {
file =
fileadmin/template/main/kuvat_catella/printer.gif
wrap = <a href="javascript:window.print()">|</a></div>
}
stdWrap.if {
value = 1
equals.data = cObj:parentRecordNumber
}
stdWrap.dataWrap = <div class="csc-header
csc-header-n{cObj:parentRecordNumber}">|</div>
}
20 = TEXT
20 {
value = |
dataWrap = <div class="csc-header
csc-header-n{cObj:parentRecordNumber}">|</div>
stdWrap.if {
value = 1
equals.data = cObj:parentRecordNumber
negate = 1
}
}
}
1 < .default.20
1.stdWrap.if >
2 < .1
3 < .1
}
}
This will kill the original dataWrap, then add the print link only for the
first element of colPos 0 (default) while rebuilding the original dataWrap
as outerWrap for all other cases.
No additional tables here, just an additional <a>-Tag containing the image
inside the <div> container.
You could even get rid of the image and insert a <span>-Tag with a text
"print this page", that you can remove with CSS image replacement
techniques.
Not tested, but should be working in a similar way.
Joey
More information about the TYPO3-english
mailing list