简体   繁体   中英

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM