[Typo3] linkWrap, enforce closing tag

Christopher bedlamhotel at gmail.com
Mon Sep 19 01:35:02 CEST 2005


On 18/09/05, Darren Clark <typo3 at cwebd.co.uk> wrote:
> I've been racking my brains about this for a while.
> 
> I'd like to create a TMENU that creates the following code:
> 
> <ul>
> <li>
> 
> (repeat this code)
> 
> <ul>
> <li>first element</li>
> <li>second element</li>
> <li>third element</li>
> <li>fourth element</li>
> </ul>
> <li>
> 
> ( end of repeat block )
> 
> 
> </li>
> </ul>
> 
> I have the the following typoscript:
> 
> <code>
> temp.menu_v2 = HMENU
> temp.menu_v2.entryLevel = 1
> temp.menu_v2.1 = TMENU
> temp.menu_v2.1 {
> wrap = <ul>|</ul>
> }
> 
> temp.menu_v2.1.NO {
> linkWrap = |*| <li><ul><li>|</li> || <li>|</li> || <li>|</li> || <li>|</li></ul></li>
> }
> 
> lib.globalnav < temp.menu_v2
> </code>
> 
> Now the problem is, if the number of menu items are exactly divisible by
> 4 then it works perfectly, but if not then the final </ul></li> is missed
> off.
> 
> Any ideas on how I can do this? Is it possible with typoscript or would
> it require an extension?
> 

No extension required; it just requires another round of reading in
the TSref [1]. Try this instead:

temp.menu_v2 = HMENU
temp.menu_v2 {
  entryLevel = 1
  
  1 = TMENU
  1 {
    wrap = <ul>|</ul>
  
    NO {
      wrapItemAndSub = <li>|</li>
    }
  }
}

-Christopher

[1] http://typo3.org/documentation/document-library/doc_core_tsref/TMENUITEM/



More information about the TYPO3-english mailing list