[TYPO3] TMENU

JoH asenau info at cybercraft.de
Tue Jan 23 00:25:48 CET 2007


> Thanks for your reply again Peter!
> I'm almost there.
> The problem is that i'm using a GMENU.
>
> How can i put the folowing part in a GMENU?
>
> --- PART TO PUT IN GMENU ---
> stdWrap.cObject = COA
> stdWrap.cObject {
>    10 = TEXT
>    10.field = title
>    20 = LOAD_REGISTER
>    20.firstPos = 1
> }
> --- PART TO PUT IN GMENU ---
>
> --- MY GMENU ---
> NO {
>       wrap = <td height="31">|</td>
>       imgParams = onMouseOver="ShowHide('menubar','hidden')"
> onMouseOut="ShowHide('menubar','visible')"
>       XY = 116,31
>       5 = IMAGE
>       5.file = fileadmin/templates/images/organisatie.gif
>       5.width = 116
>       5.height = 31
> }
> --- MY GMENU ---

Interesting question, especially when you take a look at your Subject
"TMENU" and your code, which seems to be a TMENU_LAYERS using GMENU
parameters inside its items ;-)

But lets take a closer look to the GMENU problem. This is what I understood:

1. You need the parent page of each submenu
2. You want to render the title of this parent page just once before each
submenu
3. You want to do that using a GMENU

Some useful information:
1. The parent page can be identified by the pid field of each item inside
the submenu.
2. GMENU items got a special property called allStdWrap, or if you like it
better they can use stdWrap together with the allWrap property too.
3. You can use a register that is set after the first item of a submenu is
rendered by the engine and check if the pid is the same or not
4. The GIFBUILDER TEXT Element which is used for GMENU items can be filled
using stdWrap

So what you need is a GIFBUILDER element created using the title value of a
page identified by the pid value of a submenuitem that will be rendered only
before the first item of this submenu which can be recognized by the
register using the allStdWrap property of the item - easy, isn't it? ;-)

NO {
    #########################################
    ### This will render a COA before the menu item ###
    ### but only if the pid does not equal the one in    ###
    ### the register which means we are in another   ###
    ### submenu now                                                     ###
    #########################################
    allStdWrap.prepend = COA
    allStdWrap.prepend {
        if {
            value.field = pid
            equals.data = register:parentPage
            negate = 1
        }
        wrap = <yourwrap>|</goeshere>
        10 = IMAGE
        10 {
            ###################################
            ### Same setup as your GMENU items ###
            ###################################
            file = GIBUILDER
            file {
                XY = 116,31
                backColor = #XXYYZZ
                5 = TEXT
                5 {
                    #####################################
                    ### Here we get the title of the parent page ###
                    #####################################
                    text.cObject = COA
                    text.cObject {
                        10 = RECORDS
                        10 {
                            source.field = pid
                            tables = pages
                            conf.pages = TEXT
                            conf.pages {
                                field = title
                            }
                        }
                    }
                }
            }
        }
        #######################################
        ### here we fill the current pid into the register ###
        ### so the next item wont get the title anymore ###
        #######################################
        20 = LOAD_REGISTER
        20 {
            parentPage.cObject = TEXT
            parentPage.cObject.field = pid
        }
    }
}

Not tested, but should be working.

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