[TYPO3-templavoila] FCE - how to add extra css class to first item in record list only please?
Matthias
mawe at typeofundefined.com
Mon Dec 17 20:11:02 CET 2012
Hey David! I had a similar need some time ago and solved it with a customer register. (Your use of REGISTER:tx_templavoila_pi1.sectionIsFirstItem doesn't make sense, since it's for working with TemplaVoila sections only).
Anyways, here goes my complete tabs code. I'm sure you can extract the stuff you need.
10 = COA
10 {
stdWrap.dataWrap = <div class="holy-tabs" id="holy-tabs-{register:tx_templavoila_pi1.parentRec.uid}">|</div>
# Here you create your counting register
5 = LOAD_REGISTER
5.tab_index = 0
10 = RECORDS
10 {
source.current = 1
tables = tt_content
wrap = <ul class="tabs">|</ul>
conf.tt_content = COA
# Increase the register by one
conf.tt_content.5 = LOAD_REGISTER
conf.tt_content.5.tab_index = TEXT
conf.tt_content.5.tab_index {
current = 1
setCurrent.data = register:tab_index
setCurrent.dataWrap = |+1
prioriCalc = intval
}
conf.tt_content.10 = COA
conf.tt_content.10 {
10 = TEXT
10.dataWrap = <li
# Only gets rendered if it's the first tab
20 = TEXT
20.value = class="active"
20.noTrimWrap = | ||
20.if.equals.data = register:tab_index
20.if.value = 1
30 = TEXT
30.value = >
40 = TEXT
40.dataWrap = <a href="#holy-tabs-{register:tx_templavoila_pi1.parentRec.uid}-{field:uid}">{field:header}</a></li>
}
}
20 = RECORDS
20 {
source.current = 1
tables = tt_content
wrap = <div class="tab-content">|</div>
conf.tt_content {
stdWrap.innerWrap.cObject >
stdWrap.dataWrap = <div id="#holy-tabs-{register:tx_templavoila_pi1.parentRec.uid}-{field:uid}" class="tab-content-item">|</div>
}
}
}
Am Freitag, 7. Dezember 2012 um 21:58 schrieb David Green:
> Hi list friends, :-)
>
> I'm tying to make a TV flexible content element to turn record items
> into tabbed contents using the twtter bootstrap framework.
>
> I'm almost finished, but stuck on one small detail. I've searched the
> lists and web for ages and found what I think is the right bit of the
> manuals, but don't understand it. Please would some kind person tell me
> where I'm going wrong?
>
> I'm trying to make this output structure
>
> <div class="tab-content">
> <div class="tab-pane active" id="c1">...</div>
> <div class="tab-pane" id="c2">...</div>
> <div class="tab-pane" id="c3">...</div>
> <div class="tab-pane" id="c4">...</div>
> </div>
>
> The Typoscript below works fine - except it won't add the extra css
> class "active" to the first element
>
> 20= RECORDS
> 20.conf.tt_content.stdWrap.innerWrap.cObject.default.20.10.value=tab-pane
> 20.source.current = 1
> 20.tables = tt_content
> 20.stdWrap.outerWrap = <div class="tab-content">|</div>
>
> I think what's needed must be something like this below to add the extra
> css class, but every variation I've tried doesn't work
>
> 20= RECORDS
> 20.conf.tt_content.stdWrap.innerWrap.cObject.default.20.10.value=tab-pane
> 20.conf.tt_content.stdWrap.innerWrap.cObject.default.20.10 {
> noTrimWrap = || active|
> if.isTrue.data = REGISTER:tx_templavoila_pi1.sectionIsFirstItem
> }
> 20.source.current = 1
> 20.tables = tt_content
> 20.stdWrap.outerWrap = <div class="tab-content">|</div>
>
> Please can anyone suggest what I'm doing wrong?
>
> Many thanks everyone
> David Green
>
> _______________________________________________
> TYPO3-project-templavoila mailing list
> TYPO3-project-templavoila at lists.typo3.org (mailto:TYPO3-project-templavoila at lists.typo3.org)
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-templavoila
More information about the TYPO3-project-templavoila
mailing list