[TYPO3-english] How can I give each menu item a different class? (optionSplit?)

Jost Baron Jost.Baron at gmx.de
Sat Dec 29 21:58:25 CET 2012


Hi Jörg,

you could use a field from the page record of the menu entry. For 
example, the following TS sets the subtitle of a page as class:

lib.menu = HMENU
lib.menu.1 = TMENU
lib.menu.1 {

   NO = 1
   NO {
     stdWrap.data =
     stdWrap2.dataWrap = <div class="menu-item {field:subtitle}">|</div>
   }

   ACT = 1
   ACT {
     stdWrap.data =
     stdWrap2.dataWrap = <div class="menu-item {field:subtitle} active"> 
| </div>
   }
}

You can do the same with page title, navigation title etc. It is 
probably also possible to add some field "class" to the page record 
which is only there for this purpose.

Regards,
Jost

On 12/29/2012 09:49 PM, Jörg Klein wrote:
> Hi guys,
>
> I have a normal HMENU. On the first level I want each page to be wrapped in
> a ul-tag with several classes.
>
> No comes the problem: One of these classes should be different for every
> page. (I guess that is maybe easiest by using "one", "two", "three" as class
> names.)
>
> So for the first four pages the menu should for example look like this:
> <ul class="selectable one"><li>.....</li></ul>
> <ul class="current two"><li>.....</li></ul>
> <ul class="selectable three"><li>.....</li></ul>
> <ul class="selectable four"><li>.....</li></ul>
>
> Here is the relevant part of TypoScript I have right now:
>    HEAD = HMENU
>    HEAD {
>      # Level 1
>      1 = TMENU
>      1 {
>        NO = 1
>        NO {
>          wrapItemAndSub = <ul class="selectable"><li>|</li></ul>
>        }
>      ACT = 1
>      ACT {
>          wrapItemAndSub = <ul class="current"><li>|</li></ul>
>      }
>    }
>
> The question is: How do I get these changing classes added to these ul tags?
>
> Cheers!
>
> Jörg
>
>
>
>
>
>
> _______________________________________________
> TYPO3-english mailing list
> TYPO3-english at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
>


More information about the TYPO3-english mailing list