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

JoH asenau info at cybercraft.de
Fri Feb 12 14:17:24 CET 2010


> Is there any reference about the use of {...} parameters, so i can
> look up all possible parameters. I presume that cObj:
> parentRecordNumber isn't the only one...

http://typo3.org/documentation/document-library/references/doc_core_tsref/4.3.0/view/1/2/#id2343668

Move down to the getText section, although I'm not sure if it is complete.

> If it's ok, I'd like to ask a related question (otherwise i'll post a
> new one). This is the HTML i've posted before, but with an addition:
>
> ...
> (Navigation)
> <ul id="tab-menu">|</ul>
> <li><a href="#tabs-1">|</a></li>
> <li><a href="#tabs-2">|</a></li>
> <li><a href="#tabs-3">|</a></li>
> </ul>
> ...
> (Content)
>      <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>
> ...
>
> This works like a charm (thanks Joey) but the select is called twice.
> I was wondering if this has an inpact on performance (sql query
> executed twice?) and if the TS above could be improved, F.E. to
> render the content in 1 renderObj. Now i've split it up into a
> navigation section and a content section because I couldnt figure out
> how to fit it into 1 renderObj without changing the order of the
> htmloutput (i figured- renderObj represents 1 row).

If you want to avoid the double select, you can work with a LOAD_REGISTER
that is filled during the first select and then appended to the stuff that
has already been rendered.

Example:

blah = COA
blah {
    10 = CONTENT
    10 {
        table = tt_content
        select {
            pidInList = 1,2,3
        }
        renderObj = COA
        renderObj {
            10 = LOAD_REGISTER
            10 {
                toBeAppended.cObject = TEXT
                toBeAppended.cObject {
                    field = whatever
                    dataWrap = {register:toBeAppended}<div
class="something">|</div>
                }
            }
            20= TEXT
            20.field = another
            20.wrap = <div class="somethingelse">|</div>
        }
    }
    20 = TEXT
    20.data = register:toBeAppended
}

This will render a group of <div> elements with the class "somethingelse"
first and then append a group of <div> elements with class "something".
I guess this should be enough to get the approach.

HTH

Joey

-- 
Wenn man keine Ahnung hat: Einfach mal Fresse halten!
(If you have no clues: simply shut your gob sometimes!)
Dieter Nuhr, German comedian
Xing: http://contact.cybercraft.de
Twitter: http://twitter.com/bunnyfield
TYPO3 cookbook (2nd edition): http://www.typo3experts.com




More information about the TYPO3-english mailing list