[TYPO3-english] Split submenu TS challenge

Sergey Alexandrov serg at alexandrov.us
Tue Apr 26 23:16:29 CEST 2011


This will not sort pages out as Paul wanted tho

On 4/26/2011 4:53 PM, Philipp Gampe wrote:
> Hi Paul,
>
> I have no time to create and test a full version, but I give you some hinds
> below:
>
> Paul Vetch wrote:
>
>> Trying to figure out if I can do something with TS alone.  What I want is
>> a grouped megadropdown menu, two levels: level 1 is a simple, standard top
>> level menu, but for second level pages, I want pages split into two
>> groups: first, pages with images would be output with image, page title
>> and abstract; and secondly, pages without an image would just be listed
>> with
>> their titles.  Consider the following page tree, where an * means a page
>> has an image:
>>
>> Page 1
>> Page 2
>> - Page 2.1
>> - Page 2.2 *
>> - Page 2.3
>> - Page 2.4 *
>> Page 3
>>
>> I'd want this output as:
>>
>> <ul>
>> <li><a>Page 1</a></li>
>> <li><a>Page 2</a>
>>    <ul>
>>      <li>Page 2.2* [+ image and abstract]</li>
>>      <li>Page 2.4* [+ image and abstract]</li>
>>    </ul>
>>    <ul>
>>      <li>Page 2.1</li>
>>      <li>Page 2.3</li>
>>    </ul>
>> </li>
>> <li><a>Page 3</a></li>
>> </ul>
>>
>> Can I do this with TS?
> First of all the general TS of menus looks like this:
>
> menu = HMENU
> menu.special = directory
> menu.special.value = ###page id of root page###
> menu.wrap =<nav id="main">|</nav>
>
> menu.1 = TMENU
> menu.1 {
>    wrap =<ul>|</ul>
>    expAll = 1
>    NO = 1
>    NO.allWrap =<li>|</li>
>
>    IFSUB<  .NO
>    IFSUB.allWrap =<li class="hassub">|</li>
>
>    ACT<  .NO
>    ACT.allWrap =<li class="active">|</li>
>
>    CUR<  .NO
>    CUR.allWrap =<li class="active you-are-here">|</li>
> }
> menu.2<  menu.1
> menu.3<  menu.1
> menu.4<  menu.1
> menu.4.wrap =<ul class"level-4">|</ul>
>
> This gives you a basic, nested menu with ul, li lists.
>
> What you need to do now is to put some conditions to to "wrap" lines. All
> lines with the word "wrap" in it have "stdWrap" properties. That means you
> can use everything you find here:
> http://typo3.org/documentation/document-library/core-
> documentation/doc_core_tsref/4.4.0/view/1/5/#id2618234
>
> Have a special look at required and override and if. You might find ifEmpty
> being a useful property ;)
> Also you can use wrap.cObject to have a fully recursive option for very
> complex scenarios. But I think you will only need ifEmpty to do what you
> want ;)
>
>
> Best regards


More information about the TYPO3-english mailing list