简体   繁体   中英

TYPO3 different layout in TMENU for a special UID (2 TMENU inside 1 HMENU)

I try to setup a Menu in TYPO3 which got a fixed layout and style. But there is one UID for which I have to set other styles and other wrappings.

I tried to use override fpr allWrap, this works well. But wrap.override won't work :(

For the reason that I have three levels inside the menu, I think about using the levelUID:1 to check which menupoint actually has to be rendered. But how can I access the LEVELUID:1 inside a Menu?

Maybe there are better / other solutions? At the moment, I splitted those two menus up into two separated scripts. This can't be as it makes a positioning inside the menu impossible.

the normal menu:

lib.field_mainnav = HMENU
lib.field_mainnav {
    entryLevel = 0
    excludeUidList = {$featureMenuUid}
    wrap = <ul class="sf-menu fixed" id="menu">|
    1 = TMENU
    1 {
        expAll = 1
        NO.stdWrap.wrap = <span> | </span>
        NO.linkWrap = <li>|</li>
        IFSUB = 1
        IFSUB.allWrap = <li class="dropdown">|<ul>
        IFSUB.stdWrap.wrap = <span> | </span>
        ACTIFSUB = 1
        ACTIFSUB.allWrap = <li class="current dropdown">|<ul>
        ACTIFSUB.stdWrap.wrap = <span> | </span>
        ACT = 1
        ACT.allWrap = <li class="current">|<ul> 
        ACT.stdWrap.wrap = <span> | </span>

    }
    2 = TMENU
    2 {
        expAll = 1
        wrap = |</ul></li>
        NO.linkWrap = <li>|</li>
        IFSUB = 1
        IFSUB.allWrap = <li class="dropdown">|<ul>
    }
    3 = TMENU
    3 < .2
    4 = TMENU
    4 < .2
}

And the special menu for the site with UID 155 (and all subpages of it)

lib.field_featurenav = HMENU
lib.field_featurenav {
    wrap=|</div></ul>
   special = directory
    special.value = {$featureMenuUid}

    1 = TMENU
    1 {
        expAll = 1
        NO.stdWrap.wrap = <span> | </span>
        NO.linkWrap = <li>|</li>
        IFSUB = 1
        IFSUB.allWrap = <li>| <div class="sf-mega">
        IFSUB.stdWrap.wrap = <span> | </span>
        ACTIFSUB = 1
        ACTIFSUB.allWrap = <li>| <div class="sf-mega">
        ACTIFSUB.stdWrap.wrap = <span> | </span>
        ACT = 1
        ACT.allWrap = <li>| <div class="sf-mega">
        ACT.stdWrap.wrap = <span> | </span>

}
2 = TMENU
2 {
    expAll = 1
    wrap = <div class="sf-mega-section"><ul>|</li>
    NO.linkWrap = <li>a|e</li>

    IFSUB = 1
    IFSUB.allWrap = <li>|
    IFSUB.stdWrap.cObject = COA
    IFSUB.stdWrap.cObject {


    10 = TEXT
    10.field = tx_pricons_pr_icons
    10.wrap = <!!=|></i>
    20 = TEXT
    20.field = title
    20.wrap =&nbsp;|
}
}
3 = TMENU
3 {
    expAll = 1
    wrap = <li>|</li></ul></div><div class="sf-mega-section"><ul>
    NO.linkWrap = <li>|</li>
    NO.stdWrap.cObject = COA
    NO.stdWrap.cObject {


    10 = TEXT
    10.field = tx_pricons_pr_icons
    10.wrap = <!!=|></i>
    20 = TEXT
    20.field = title
    20.wrap =&nbsp;|
    }
}
4 = TMENU
4 < .2

}

EDIT: I think I should do something like this:

    NO{

        linkWrap = <li>|</li>
        if{ 
            value.data = leveluid : 1 
            IsInList = {$featureMenuUid}
            stdWrap.Wrap = do another kind of wrap|to this element
        } 

    }

How can I prove the leveluid :1. and if it matches the featureMenuId do an override.

Is there no possibility to get the Leveluid : 1 of the actual {field:uid} ?

This would be solving my problem but I found nothing.

Maybe using a case object with the key on the uid?

Like this:

lib.nav = HMENU
lib.nav {

    entryLevel = 0

    1 = TMENU
    1 {
        expAll = 1

        NO = 1
        NO.stdWrap.wrap = <span class="foo bar">|</span>
        NO.stdWrap.override.cObject = CASE
        NO.stdWrap.override.cObject {
           key.field = uid

           18 = TEXT
           18 {
               field = title
               wrap = <span class="special">|</span>
           }               

        }

    }

}

Answer to your comment:

Maybe cou can check the current rootline level of the page?

Like this:

key.cObject = TEXT
key.cObject {

    data = level

}

With data = level you will get the current level of the page.

http://docs.typo3.org/typo3cms/TyposcriptReference/DataTypes/Gettext/Index.html#level

Edited Answer to my comment: (Aug 28 at 19:35)

NO {

    wrapItemAndSub = <li>|</li>
    wrapItemAndSub.override = <li class="otherWrap">|</li>
    wrapItemAndSub.override.if { 
        value = {$featureMenuUid}
        equals.field = uid
    } 

}

What you should know, is that

wrapItemAndSub

is from type stdWrap.

And

linkWrap

is NOT from type stdWrap. So you cant use any stdWrap property there. Thats because i used wrapItemAndSub.

I hope I explained it clearly enough.

If I gave a totally wrong answer, just let me know..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM