[TYPO3-templavoila] container counter

Tolleiv Nietsch info at tolleiv.de
Sun May 31 13:02:48 CEST 2009


Sander van Gelderen schrieb:
> Hello List,
> 
> I have a repetetive content element with a section, container, and two 
> images.
> 
> How can I insert a counter-value to the wrap? Similar to 
> cObj:parentRecordNumber, so each image will have the next value in a 
> sequence?
> 
> For example:
> 
> 10 = IMAGE
> 10...
> ..
> 10.wrap = <div class="image{whatGoes:here}">|</div>
> 
> 
> TIA
> 
> Sander van Gelderen


Hi,
afaik there's no build-in counter available, but you can easily use the 
TypoScript LOAD_REGISTER function:

10 = LOAD_REGISTER
10.counter.data = register:counter
10.counter.stdWrap.wrap = |+1
10.counter.prioriCalc=intVal

afterwards you can use like this:
20 = TEXT
20.value = my Textvalue
20.dataWrap = <div class="n{register:counter}">|</div>

If you have multiple elements with these counters on a page you should 
also initialize the register properly....

Regards,
Tolleiv


More information about the TYPO3-project-templavoila mailing list