[TYPO3] Setting different ids in menu enclosing divs

JoH asenau info at cybercraft.de
Thu Dec 21 05:39:50 CET 2006


>> Set it on the menu item and not the menu - the NO not the tmenu
>> itself
>
> Thanks Tyler, that does it for the menu(I'm getting closer and
> understanding a lot), but not for the enclosing div.
>
> The (simplified) html template has:
>
> <ul>
>    <li>Menu 1</li>
>    <div id="menu_1">
>      <li>Menu 1.1</li>
>      <li>Menu 1.2</li>
>    </div>
>
>    <li>Menu 2</li>
>    <div id="menu_2">
>      <li>Menu 2.1</li>
>    </div>
> </ul>
>
> All I want is to be able to create those div with an unique id (the
> designer wrote menu_1, but it could be anything), one that will be
> passed to onclick with ATagParams.
>
> I read about all properties, about calling functions
> (parentObj->id),{$parentObj.id},{page:id} but I never get the parent,
>    or any other id in the div!

First of all, the HTML is not valid and second you don't need the uid but
just a simple counter, which is available as a register.

The structure has to be:

<ul id="mainmenu">
    <li>level 1 entry
        <ul id="level1_1">
            <li>level 2 entry</li>
            <li>level 2 entry</li>
            <li>level 2 entry</li>
        </ul>
    </li>
    <li>level 1 entry
        <ul id="level1_2">
            <li>level 2 entry</li>
            <li>level 2 entry</li>
            <li>level 2 entry</li>
        </ul>
    </li>
</ul>

TypoScript example:

temp.blah = HMENU
temp.blah {
    1 = TMENU
    1 {
        wrap = <ul id="mainmenu">|</ul>
        NO {
            allWrap = <li>|</li>
        }
        IFSUB {
            wrapItemAndSub = <li>|</li>
            ATagParams.dataWrap =
onmousover="triggerlayer(level1_{register:count_HMENU_MENUOBJ})"
            allWrap.dataWrap = |<ul
id="level1_{register:count_HMENU_MENUOBJ}">
        }
    }
    2 = TMENU
    2 {
        wrap = |</ul>
        NO {
            allWrap = <li>|</li>
        }
        IFSUB {
            wrapItemAndSub = <li>|</li>
            ATagParams.dataWrap =
onmousover="triggerlayer(level2_{register:count_HMENU_MENUOBJ})"
            allWrap.dataWrap = |<ul
id="level2_{register:count_HMENU_MENUOBJ}">
        }
    }
}

Simply replace "triggerlayer" with your JS function and adjust the way the
parameters are handed over to the function.
If you want to use CUR and ACT states you have to use at least CURIFSUB too.
ACTIFSUB is not necessary, if you are using CUR, since ACT will only be used
if the page is "open", which means that it must have subpages, else it would
be CUR.


temp.blah = HMENU
temp.blah {
    1 = TMENU
    1 {
        wrap = <ul id="mainmenu">|</ul>
        NO {
            allWrap = <li>|</li>
        }
        CUR {
            allWrap = <li class="cur">|</li>
        }
        IFSUB {
            wrapItemAndSub = <li>|</li>
            ATagParams.dataWrap =
onmousover="triggerlayer(level1_{register:count_HMENU_MENUOBJ})"
            allWrap.dataWrap = |<ul
id="level1_{register:count_HMENU_MENUOBJ}">
        }
        CURIFSUB {
            wrapItemAndSub = <li class="curifsub">|</li>
            ATagParams.dataWrap =
onmousover="triggerlayer(level1_{register:count_HMENU_MENUOBJ})"
            allWrap.dataWrap = |<ul
id="level1_{register:count_HMENU_MENUOBJ}">
        }
        ACT {
            wrapItemAndSub = <li class="act">|</li>
            ATagParams.dataWrap =
onmousover="triggerlayer(level1_{register:count_HMENU_MENUOBJ})"
            allWrap.dataWrap = |<ul
id="level1_{register:count_HMENU_MENUOBJ}">
        }
    }
    2 = TMENU
    2 {
        wrap = |</ul>
        NO {
            allWrap = <li>|</li>
        }
        CUR {
            allWrap = <li class="cur">|</li>
        }
        IFSUB {
            wrapItemAndSub = <li>|</li>
            ATagParams.dataWrap =
onmousover="triggerlayer(level2_{register:count_HMENU_MENUOBJ})"
            allWrap.dataWrap = |<ul
id="level2_{register:count_HMENU_MENUOBJ}">
        }
        CURIFSUB {
            wrapItemAndSub = <li class="curifsub">|</li>
            ATagParams.dataWrap =
onmousover="triggerlayer(level2_{register:count_HMENU_MENUOBJ})"
            allWrap.dataWrap = |<ul
id="level2_{register:count_HMENU_MENUOBJ}">
        }
        ACT {
            wrapItemAndSub = <li class="act">|</li>
            ATagParams.dataWrap =
onmousover="triggerlayer(level2_{register:count_HMENU_MENUOBJ})"
            allWrap.dataWrap = |<ul
id="level2_{register:count_HMENU_MENUOBJ}">
        }
    }
}

HTH

Joey

-- 
Wenn man keine Ahnung hat: Einfach mal Fresse halten!
(If you have no clues: simply shut your knob sometimes!)
Dieter Nuhr, German comedian
openBC/Xing: http://www.cybercraft.de
T3 cookbook: http://www.typo3experts.com




More information about the TYPO3-english mailing list