[TYPO3-english] Hierarchical menu with maxItems and more link on the bottom level

Jan Slusarczyk jan.slusarczyk at gmail.com
Wed Sep 14 14:02:36 CEST 2011


Hi,
I need a little help. I've spent few hours searching, reading and 
tearing my hair.

I have a huge number of pages ordered in 3 level hierarchy. I need to 
create a menu that would let me display the last level as two last pages 
and "more articles" link below. This would be in fact a link to the 
parent page of a section.

Imagine the hierarchy as:
level1
  - level2 sub1
    - level3.1 article 1
    - level3.1 article 2
    - level3.1 article ...
    - level3.1 article X
  - level2 sub2
    - level3.2 article 1
    - level3.2 article 2
    - level3.2 article ...
    - level3.2 article X



I would like to render the menu as a standard ul li hierarchy, but with 
a twist. Because of the number of articles I cannot have all of them. I 
currently use maxItems to limit their number to 2, but I need to 
indicate somehow, that there's more in this section. I think of 
something like this:

<ul class="level1">
  <li class="menulevel1">
   <a href="Level1">Level1</a>
    <ul>
     <li class="menulevel2">
      <a href="Level2.1" >Level2.1</a>
       <ul class="menulevel3">
        <li><a href="Level3.1a1">Level3.1a1</a></li>
        <li><a href="Level3.1a2">Level3.1a2</a></li>
        <li><a href="Level2.1">more...</a></li>
       </ul>

It would be even better I could insert the number of articles in the 
section:

<li><a href="Level2.1">43 more articles...</a></li>

The starting point of my search is the following tsctipt of ul/li tmenu:

lib.menu = HMENU
lib.menu {
  entryLevel = 0
  1 = TMENU
  1 {
   wrap = <ul class="menulevel1">|</ul>
   NO {
    wrapItemAndSub = <li>|</li>
   }
  }
  2 = TMENU
  2 {
   expAll = 1
   wrap = <ul class="menulevel2">|</ul>
   NO {
    wrapItemAndSub = <li>|</li>
   }
  }
  3 = TMENU
  3 {
   maxItems = 2
   expAll = 1
   wrap = <ul class="menulevel3">|</ul>
   NO {
    wrapItemAndSub = <li>|</li>

   }
  }
}

1. How can I add a link inside <ul class="menulevel3"> to the parent of 
a section?
2. Is it possible to count all the pages or remaining pages in the 
section and insert their number into this link?

Thank you in advance
Jan


More information about the TYPO3-english mailing list