[TYPO3] caption split on <ul>

Christopher bedlamhotel at gmail.com
Sat May 20 19:07:36 CEST 2006


Hi,

On 5/20/06, Krystian Szymukowicz <t33k.RE.MO.VE at re.mo.ve.prolabium.com> wrote:
>
> hello
>
> I would like to get almost standard ul li menu like this:
>
> <ul>
>         <li><a href="">main item 1</a>
>                 <ul class="a1">
>                         <li><a href="">...</a><li>
>                 </ul>
>         </li>
>         <li><a href="">main item 2</a>
>                 <ul class="a2">
>                         <li><a href="">...</a><li>
>                 </ul>
>         </li>
>         <li><a href="">main item 3</a>
>                 <ul class="a3">
>                         <li><a href="">...</a><li>
>                 </ul>
>         </li>
> </ul>
>
> Not standard is that each <ul> have its own classes.
>
> The problem is that I can not make option split on <ul> to get <ul class="a1">, <ul class="a2"> etc
>
> What I try is:
>
>
> lib.menu_top = HMENU
> lib.menu_top {
>
> 1 = TMENU
> 1 {
>     expAll = 1
>     wrap = <ul>|</ul>
>     NO {
>         allWrap = |
>         stdWrap.htmlSpecialChars = 1
>         wrapItemAndSub = <li class="first">|</li> |*| <li class="normal">|</li> |*| <li class="last">|</li>
>         }
>      }
>
> 2 = TMENU
> 2 {
>     expAll = 1
>     wrap = <ul class="1">|</ul> || <ul class="2">|</ul> || <ul class="3">|</ul>
>
>     NO {
>     stdWrap.htmlSpecialChars = 1
>     wrapItemAndSub = <li class="first">|</li> |*| <li class="normal">|</li> |*| <li class="last">|</li>
>      }
> }
>
>
> }
>
>
>
> but it seems that TMENU.wrap has no option split as it does not work. All ul have class="1".
>
>
> I hope you know the solution and are so kind to share.


Well, I see a couple of things to begin with:

1. Unnecessary classes?

If you've already successfully achieved the insertion of a class
attribute into each of the top-level <li> elements, then you only need
optionsplit on the second level <ul> elements if there will be
multiple, differently styled <ul> elements inside the top level <li>.
For example, if there will only be ONE <ul> inside any given top-level
<li>, then you should have no trouble styling things this way:

li.1 ul { ... }
li.2 ul { ... }
li.3 ul { ... }

However, I guess it's possible that you might need this kind of code:

<ul>
<li>
<a href="/foo/">Foo</a>

<ul class="1">
<li><a href="/bar/">Bar</a></li>
</ul>

<ul class="2">
<li><a href="/fubar/">Fubar</a></li>
</ul>

</li>
</ul>

...this, at least seems to be what your posted TS is trying to
achieve--and by the way, I can't see any good reason for doing this;
the 'proper' way would be to have each sub-list enclosed in its own
<li>...


2. There is a logical error in the way you're trying to build the menu.

".wrap" is a property of the ENTIRE second level menu belonging to any
given top-level menu item. Any given parent in a menu can only contain
ONE menu on the next level--though that next-level menu may contain
any number of items. But because there can only be one submenu for any
given item in the top level, it makes no sense to use optionsplit on
the wrap for the whole submenu.


Anyway, what would be helpful is is you were to post what it is you're
trying to achieve with the css; it's almost certain to be achievable,
but it's also impossible from your code above to figure out what it is
you need to do. Why not provide a sample of the ideal output of the
menu, complete with all the classes etc you're trying to add to the
code?


-Christopher



More information about the TYPO3-english mailing list