Felix
Felix

Reputation: 5629

TYPO3: typoscript wrap two elements with div

is it possible to wrap always two <li> elements in a div in typoscript?

at the moment it looks like this:

navStatic = HMENU
navStatic {
    special = directory
    special.value = 2
    excludeUidList = 2
    1 = TMENU
    1 {
        expAll = 1
        wrap = <ul class="headernavmenu">|</ul>
        noBlur = 1

        NO = 1
        NO {
            ATagTitle.field = title
            wrapItemAndSub = <li>|</li>
            allWrap =   |  I  |*| |  I  |*| |
        }

        ACT < .NO
        ACT.ATagParams = class="active_static"
    }
}

thanks in advance

Upvotes: 0

Views: 288

Answers (1)

David
David

Reputation: 6084

This addition to your TypoScript should do the job, just when an odd number of li-elements is in the list the last single li-element is not wrapped.

NO.wrapItemAndSub.outerWrap =   <div class="two-list-elements">  || ||  </div>

Be advised that this HTML-solution is error-prone as browsers might interpret it different or not at all because the HTML is not standard-conform.

Upvotes: 1

Related Questions