[TYPO3-english] how to create dynamic css class based on a counter

jochem nabuurs jochem at roquin.nl
Fri Feb 12 12:41:10 CET 2010


Hi list,

On a website i'm developing, a teaser with portfolio items will be shown.
I've got to reproduce the following HTML with typoscript for it:

...
	<div id="tabs-1" class="block block-grey">
`		...
	</div>
	<div id="tabs-2" class="block block-grey">
		...
	</div>
	<div id="tabs-3" class="block block-grey">
		...
	</div>
...

The TS I've come up with is the following:


// Portfolio items
lib.portfolioSelect = CONTENT
lib.portfolioSelect {
	table= tt_news
	select {
         	// Select only CE from a specific sysfolder/page
         	pidInList = {$portfolio.pid_list}

         	// Order content by date
         	orderBy = datetime DESC
	}
}

temp.portfolioContent = CONTENT
temp.portfolioContent =< lib.portfolioSelect
temp.portfolioContent {
	// Renders the content as an image with text
	renderObj = COA
   	renderObj{

             // Wrap element in totality
             stdWrap.dataWrap = <div id="tabs-{field:uid}" class="block 
block-grey">|</div>

             // Image
     		5 = IMAGE
     		5 {
                 file {
                     import = uploads/pics/
                     import.field = image

                     //width = 186c
                     //maxWidth = 186c
                 }
             }

             // Title
             10 = TEXT
             10 {
                 field = title
                 wrap = <h4>|</h4>
             }

             // Content
             12 = COA
             12 {
                 1 = TEXT
                 1 {
                     field = bodytext
                     parseFunc < lib.parseFunc_RTE
                     wrap = <p>|</p>
                     crop = 200|...|1
                     if.isFalse.field = image
                 }

                 2 < .1
                 2.crop = 100|...|1
                 2.if.negate = 1
             }

             // Link to detail page
             20 = TEXT
             20.typolink.parameter = {$portfolio.singlePid} _top 
read-more  "Lees verder"
		}
	}
}


This works partially. What i'd like to do is replace 
id="tabs-{field:uid}" for a counter.

I've read a bit about LOAD_REGISTER but I can't seem to grasp the 
concept of it. I don't even know if it's possible with LOAD_REGSTER...

In general, is it possible to generate a counter wich starts at 0 and 
increments with 1 for each countent element found.

Thanks for any help on this issue.

Kind regards,

Jochem Nabuurs



More information about the TYPO3-english mailing list