[TYPO3-english] odd / even classes for every second record
B.Wolf
bw at shs-it.de
Tue Jan 12 10:43:04 CET 2010
Hello Peter,
thanks for your answer and the code snippet.
I'm not so familiar with typo3 yet and have another question:
temp.boxenelemente = CONTENT
temp.boxenelemente {
table = tt_content
select {
where = colPos = 2
}
renderObj = COA
renderObj {
10=TEXT
10{
value=SAMPLETEXT
}
}
}
How can I set the database-content from the selected rows to the
value-property instead of the "SAMPLETEXT"-string?
Again, thx+greets,
ben
Peter Russ schrieb:
> --- Original Nachricht ---
> Absender: B.Wolf
> Datum: 11.01.2010 16:29:
>> Hi there.
>>
>> I'm using "insert records" to put often used boxes into the right
>> column of my site. To display them on the page I use the
>> following code:
>>
>> temp.boxenelemente = CONTENT
>> temp.boxenelemente {
>> table = tt_content
>> select {
>> where = colPos = 2
>> orderBy = sorting
>> }
>> }
>>
>> subparts.sidebar< temp.boxenelemente
>>
>>
>> Now every second box should have a different header-color, so I would
>> like to wrap the first box-element in a div with the class 'odd' and
>> the second in a div with the class 'even' - or something like that.
>> I have no clue how I could achieve this - any help is very welcome.
>>
>> Thank you very much!
>
> Register is your friend:
> Take the actual record count, modulo 2 and store it.
> Depending if the result is 1 override the the wrap.
>
> Does that help?
>
> If not here is a more complex example: (doing a m x n matrix)
>
> genericAuction=CONTENT
> genericAuction{
> table=###TBD###
> select{
> where=###TBD###
> orderBy=
> max=20
> }
> renderObj=COA
> renderObj{
> 1=LOAD_REGISTER
> 1.counter=0
> 1.counter{
> override=1
> override{
> if.isFalse.prioriCalc=1
> if.isFalse.cObject=TEXT
> if.isFalse.cObject{
> insertData=1
> value=1
> wrap=({cObj:parentRecordNumber}-1) %|
> }
> }
> }
> 1.modulo=0
> 1.modulo{
> override=1
> override{
> if.isFalse.prioriCalc=1
> if.isFalse.cObject=TEXT
> if.isFalse.cObject{
> insertData=1
> value=1
> wrap=(({cObj:currentRecordTotal} -
> ({cObj:parentRecordNumber}-1)) / |)%2
> }
> }
> }
>
> 10=COA
> 10{
> stdWrap.outerWrap.cObject=COA
> stdWrap.outerWrap.cObject{
> 10=COA
> 10{
> stdWrap.outerWrap=<div class="|">
> 10=COA
> 10{
> 10=TEXT
> 10{
> value=item
> outerWrap=|-regular
> outerWrap.override.cObject=TEXT
> outerWrap.override.cObject{
> if.isTrue.data=register:counter
> value=|-break
> }
> }
> stdWrap.outerWrap=|-fx even
> stdWrap.outerWrap.override.cObject=TEXT
> stdWrap.outerWrap.override.cObject{
> if.isTrue.data=register:modulo
> value=|-fx odd-cell
> }
> }
> }
> 20=TEXT
> 20{
> value=|
> wrap=|</div>
> }
> }
> 10=TEXT
> 10{
> value=Hier kommt der Inhalt rein
> }
> }
> }
> }
>
More information about the TYPO3-english
mailing list