[TYPO3-english] How to add a line break with wrapItemAndSub ?

Jean-Claude Jouffre jean-claude.jouffre at univ-savoie.fr
Fri Apr 18 17:00:13 CEST 2014


Hello,

As typo3 generates an entire menu on one HTML line, web browsers (firefox and IE) don't display menus the same way as if the HTML code would be indented.

So, I would like to generate a 2 levels menu, with a line break after each menu level, like that :
<ul>
<li>
<a href="">1rst level</a>
<ul>
<li><a href="">2nd level 1</a></li>
<li><a href="">2nd level 2</a></li>
</ul> 
</li>
</ul>

To do that, I used the noTrimWrap function :

It works for stdWrap.noTrimWrap and allStdWrap.noTrimWrap : so, I've got 90% of all line breaks.

That is my output :

<ul class="menu_level1"><li id="L1">
<a href=""  class="linkLevel1">Title 1 Level 1</a>
</li><li id="L1">
<a href=""  class="linkLevel1">Title 2 Level 1</a>

<ul class="menu_level2">
<li id="L2"><a href=""  >Subtitle 1 level 2</a></li>
<li id="L2"><a href=""  >Subtitle 2 level 2</a></li></ul>
</li></ul>

and my typoscript :

  TOPNAV1 = HMENU
  TOPNAV1 {
    1 = TMENU
    1 {
      stdWrap.noTrimWrap (
|
<ul class="menu_level1">|</ul>
|
)
      noBlur = 1
      expAll = 1
      NO = 1
      NO {
        wrapItemAndSub = <li id="L1">|</li>
        allStdWrap.noTrimWrap (
|
|
|
)
        ATagParams = class="linkLevel1"
      }
      ACT < NO
    }
    2 = TMENU
    2 {
      stdWrap.noTrimWrap (
|
<ul class="menu_level2">|</ul>
|
)
      noBlur = 1
      NO = 1
      NO {
        allStdWrap.noTrimWrap (
|
<li id="L2">|</li>|
)
      }
      ACT < NO
    }
  }

But, to finish the job, I must have a line break surrounding the <li id="L1"> <li> which comes from the wrapItemAndSub function.

Unfortunatly, wrapItemAndSub.noTrimWrap does not do anything. Do you have an idea of what to do ?

Thanks in advance

P.S. : I use the 4.5 LTS version of typo3



More information about the TYPO3-english mailing list