[TYPO3-english] Iterations with TS

Christian Zenker christian.zenker at 599media.de
Mon Dec 12 11:35:38 CET 2011


Hi Mikel.

Depending on what you want to achieve there are multiple options.

I guess the code you posted is used inside a LOAD_REGISTER, right? But  
where do you get your data from? A CONTENT object?
In this case you could do something like

10 = LOAD_REGISTER
10.counter = 100

20 = CONTENT
20 {
     # ...
     renderObj = COA
     renderObj {
         10 = LOAD_REGISTER
         10.counter {
             # ...
         }
         20 = TEXT
         # ...
     }
}

30 = RESTORE_REGISTER

But the great disadvantage here is that each LOAD_REGISTER should be  
matched by one RESTORE_REGISTER and you had to do some really ugly coding  
to get this working here. In the worst case this could fall back on you  
later on, so I don't recommend this.

So I've got two more recommendations:

1. Use a userFunc. If you know some PHP just write a simple static PHP  
class that does the counting and fetch the value through preUserFunc.

2. Use split  
(http://typo3.org/documentation/document-library/core-documentation/doc_core_tsref/4.6.0/view/1/5/#id2621952).  
As you have fixed values this could actually work, but it depends on what  
you are trying to do.

Christian.

On Fri, 09 Dec 2011 18:49:29 +0100, Mikel <lists at wohlschlegel.org> wrote:

> Hi all,
>
> is there a chance to count an integer downwards via TypoScript?
>
> Example for counting upwards:
> counter.cObject=TEXT
> counter.cObject.data=register:counter
> counter.cObject.wrap=|+1
> counter.prioriCalc=intval
>
> I need to count down from 100 --> 99, 98, 97...
> So I just need to define the starting point in the example above and  
> turn the + to -.
> Any idea?
>
> Mikel


More information about the TYPO3-english mailing list