---
title: "TIP - GMENU_LAYERS mit unterschiedlichen Farben"
url: "https://www.typo3.net/d/3795-tip-gmenu-layers-mit-unterschiedlichen-farben"
source: "typo3.net"
tags: ["TYPO3","Menüs","Tipp"]
created: "2003-07-01"
last_reply: "2004-06-21"
replies: 8
solved: false
page: 1
pages: 1
lang: "de"
---

# TIP - GMENU_LAYERS mit unterschiedlichen Farben

TYPO3 › Menüs · 8 Antworten · gestartet 2003-07-01

## Eröffnungsbeitrag

**jean** · 2003-07-01 · [Beitrag #1](https://www.typo3.net/d/3795-tip-gmenu-layers-mit-unterschiedlichen-farben/1)

Ich habe gerade an die englische Mailingliste meine Vorgehensweise zur Erstellung eines GMENU_LAYERS mit unterschiedlichen Farben für die einzelnen Bereich gepostet.

Ich denke das ist auch für das deutsche Forum interessant, da ich hier schon mehrere Postings und Fragen dazu gesehen habe. Die Erklärungen sind aus meiner Mail herauskopiert und in englisch. Das sollte aber kein Problem darstellen.

Wenn doch - einfach Frage ins Forum stellen ;-)

#########################

GMENU_LAYERS with multiple Colors

I wanted to create a Menu with two Levels which consisted of several different Menues and Submenues, each with its own Color definition to match a different category (like <http://www.geo.de>).

The GMENU_LAYER is described in the TS-Reference as the function to accomplish that, but you can only define one Colorset for the Main- and Submenues (at least that is what i read). In order to use different Colorsets for different Main- and Submenu-Items you can try my approach:

############
### 1.) Changes in the Setup-Field of the Template:
##########

### Creation Main-Menu - Part 1 with Colorset 1  ###

tmp.NAVI1 = HMENU
### Menucreation from Subpages of Pageid 2 ###
tmp.NAVI1.special = directory
tmp.NAVI1.special.value = 2
tmp.NAVI1.1 = GMENU_LAYERS
tmp.NAVI1.1 {
   relativeToParentLayer = 1
   relativeToTriggerItem = 1
   topOffset = 25
   expAll=1
   collapse = 1
### Definition of the normal state of the menu ###
   NO {
### The Colordefinition for the Background of the Image is a ###
### Variable, which is later defined in the Constants-Field  ###
      backColor = {$varMAINMENU1_NO_BGCOLOR}
      XY = 100, 25
### Wrapdefinition specific to my Layout - you probably don't ###
### need that ###
      wrap = <td> | </td>
      10 = TEXT
      10 {
         text.field = title
         fontFile = fileadmin/fonts/akzi_g_bl.ttf
         fontSize = 12
### The Colordefinition for the Fontcolor of the Image is a ###
### Variable, which is later defined in the Constants-Field ###
         fontColor = {$varMAINMENU1_NO_FONTCOLOR}
         offset = 10,18
         align = left
         niceText = 1
      }
      11 = IMAGE
      11.offset = 0,0
   }

### Definition of the active state of the menu ###
   ACT < .NO
   ACT = 1
   ACT {
         backColor = {$varMAINMENU1_ACT_BGCOLOR}
         10.fontColor = {$varMAINMENU1_ACT_FONTCOLOR}
         11 = IMAGE
         11.mask = fileadmin/menuelemente/menu_background_ws.gif
         11.offset = 0,0
         }
### Definition of the rollover state of the menu ###
   RO < .NO
   RO = 1
   RO {
         backColor = {$varMAINMENU1_RO_BGCOLOR}
         10.fontColor = {$varMAINMENU1_RO_FONTCOLOR}
         11 = IMAGE
         11.file = fileadmin/menuelemente/menu_background_rot.gif
         11.mask = fileadmin/menuelemente/menu_background_sw.gif
         11.offset = 0,0
         }
      }
}      ### End tmp.NAVI1.1

### Creation of the Submenu for Part 1 with Colorset 1  ###

tmp.NAVI1.2 = GMENU
tmp.NAVI1.2 {
   NO {
### Wrapdefinition specific to my Design - you probably ###
### don't need that ###
   wrap = <img src=/fileadmin/white_space.gif height="1" width="100"><br> | <br>
      backColor = {$varSUBMENU1_NO_BGCOLOR}
      XY = 100, 20
      10 = TEXT
      10 {
         text.field = title
         fontFile = fileadmin/fonts/akzi_g_reg.ttf
         fontColor = {$varSUBMENU1_NO_FONTCOLOR}
         fontSize = 11
         offset = 3,13
         niceText = 1
      }
   }
   ACT < .NO
   ACT = 1
   ACT.backColor = {$varSUBMENU1_RO_BGCOLOR}
   ACT.10.fontColor = {$varSUBMENU1_RO_FONTCOLOR}

   RO < .NO
   RO = 1
   RO.backColor = {$varSUBMENU1_RO_BGCOLOR}
   RO.10.fontColor = {$varSUBMENU1_RO_FONTCOLOR}
}      ### End tmp.NAVI1.2

### Creation Main-Menu - Part 2 with Colorset 2  ###

### Copying the whole Setup from the first Part to the Second Part ###
tmp.NAVI2 < tmp.NAVI1

### Menucreation from Subpages of Page-Id 3 ###
tmp.NAVI2.special.value = 3

### Changing the Colordefinitions to a different Colorset for ###
### Main- and Submenu ###
tmp.NAVI2.1.NO.backColor = {$varMAINMENU2_NO_BGCOLOR}
tmp.NAVI2.1.NO.10.fontColor = {$varMAINMENU2_NO_FONTCOLOR}
tmp.NAVI2.1.ACT.backColor = {$varMAINMENU2_ACT_BGCOLOR}
tmp.NAVI2.1.ACT.10.fontColor = {$varMAINMENU2_ACT_FONTCOLOR}
tmp.NAVI2.1.RO.backColor = {$varMAINMENU2_RO_BGCOLOR}
tmp.NAVI2.1.RO.10.fontColor = {$varMAINMENU2_RO_FONTCOLOR}

tmp.NAVI2.2.NO.backColor = {$varSUBMENU2_NO_BGCOLOR}
tmp.NAVI2.2.NO.10.fontColor = {$varSUBMENU2_NO_FONTCOLOR}
tmp.NAVI2.2.ACT.backColor = {$varSUBMENU2_RO_BGCOLOR}
tmp.NAVI2.2.ACT.10.fontColor = {$varSUBMENU2_RO_FONTCOLOR}
tmp.NAVI2.2.RO.backColor = {$varSUBMENU2_RO_BGCOLOR}
tmp.NAVI2.2.RO.10.fontColor = {$varSUBMENU2_RO_FONTCOLOR}

### Replacing the marker within my Template with the Menuelements  ###

temp.mainTemplate = TEMPLATE
temp.mainTemplate {
   template = FILE
   template.file = fileadmin/templates/template.html

   workOnSubpart = DOCUMENT_BODY

   marks.NAVI1 < tmp.NAVI1
   marks.NAVI2 < tmp.NAVI2
}

############
### 2.) Changes in the Constant-Field of the Template:
############

### Colordef. of all Menuelements ###
varMAINMENU1_NO_BGCOLOR = #A13031
varMAINMENU1_NO_FONTCOLOR = #F3ABA8
varMAINMENU1_ACT_BGCOLOR = #A13031
varMAINMENU1_ACT_FONTCOLOR = #FFFFFF
varMAINMENU1_RO_BGCOLOR = #E22E26
varMAINMENU1_RO_FONTCOLOR = #FFFFFF
varSUBMENU1_NO_BGCOLOR = #E22E26
varSUBMENU1_NO_FONTCOLOR = #FFFFFF
varSUBMENU1_RO_BGCOLOR = #F3ABA8
varSUBMENU1_RO_FONTCOLOR = #A13031

varMAINMENU2_NO_BGCOLOR = #0B344A
varMAINMENU2_NO_FONTCOLOR = #8297A2
varMAINMENU2_ACT_BGCOLOR = #0B344A
varMAINMENU2_ACT_FONTCOLOR = #DCE6D2
varMAINMENU2_RO_BGCOLOR = #8297A2
varMAINMENU2_RO_FONTCOLOR = #0B344A
varSUBMENU2_NO_BGCOLOR = #8297A2
varSUBMENU2_NO_FONTCOLOR = #0B344A
varSUBMENU2_RO_BGCOLOR = #FFFFFF
varSUBMENU2_RO_FONTCOLOR = #0B344A

############
### 3.) Part of the Template-File "template.html", in which the
### Marker ###NAVI1### and ###NAVI2### are replaced: ###
#########

<table border="0" cellpadding="0" cellspacing="0">
   <tr>
   ###NAVI1######NAVI2###
   </tr>
</table>

############
### 4.) Important Notes and Limitations
############

It is very important to remember the order in the Setup-Part. You have to define the GMENU_LAYER first and later copy the whole setup into
to the part where the markers are replaced. If you define the whole
GMENU_LAYERS within the "workOnSubpart"-Boundaries it will not work.

Since it is technically a second menu you will have some problems with the "expAll"-Option. The Menues will expand, but if you move the Mouse over the second part of the Menu (with the different Colordefinition) it will not collapse. I think i can solve this by setting a timer, but i have not yet continued with that line of thought.

have fun,

jcg

## Antworten

### [#2](https://www.typo3.net/d/3795-tip-gmenu-layers-mit-unterschiedlichen-farben/2) · s.​sach · 2003-08-04

Hi Leute,

hat schon jemand dieses Menü zum Laufen gebracht? Hab alles 1:1 übernommen, bekomme aber immer Fehlermeldung "Page not configured".

Hab das Setup wie folgt geändert:

```typoscript
page.includeLibs.gmenu_layers = media/scripts/gmenu_layers.php
page = PAGE
page.typeNum = 0
page.10 = TEMPLATE
page.10 {
template = FILE
template.file = fileadmin/test.htm
workOnSubpart = DOCUMENT_BODY

marks.NAVI1 < tmp.NAVI1 
marks.NAVI2 < tmp.NAVI2 
}
```

Jetz bekomme ich keine Fehlermeldung mehr. Ein Menü wird aber nicht erzeugt.

In den Beispiel fehlt doch die Angabe:

```typoscript
page.includeLibs.gmenu_layers = media/scripts/gmenu_layers.php
```

Oder ist dies in dem Beispiel nicht nötig?

Danke im voraus für Eure Hilfe.

Gruß
Steffen

### [#3](https://www.typo3.net/d/3795-tip-gmenu-layers-mit-unterschiedlichen-farben/3) · jean · 2003-08-04

stimmt die Zeile muss da noch rein  :o

Ich hoffe das der Code den du gepostet hast nicht alles ist was im Setup steht. Wie ich in dem Tipp geschrieben habe musst du zu Anfang die Menus definieren (im tmp-Part) und danach erst die Marker ersetzen.

Hast du auch daran gedacht im Template die entsprechenden Marker zu setzen?

gruss,
jean

### [#4](https://www.typo3.net/d/3795-tip-gmenu-layers-mit-unterschiedlichen-farben/4) · s.​sach · 2003-08-05

Hi jean,

ne ne, das ist nicht alles was im Setup steht. Natürlich auch der ganze andere Kram. Jetzt funktionierts komischerweise. Keine Ahnung was ich zuvor falsch gemacht habe  #paralyzed#

### [#5](https://www.typo3.net/d/3795-tip-gmenu-layers-mit-unterschiedlichen-farben/5) · fbrockerhoff · 2004-06-12

Hallo,

ich habe Deinen Ansatz aufgegriffen und daraus mehrere TextMenüs gebastelt. Jetzt habe ich aber das Problem, daß alle der mittels special.value übergebenen ID **untegeordneten** Menüpunkte angezeigt werden.

Ich würde aber gerne nur den direkt per ID übergebenen Punkt anzeigen und die untergeordneten über ein sep. Menü. Die TMenu-Ref hilft mir leider nicht weiter oder ich bin zu blöd entsprechende Optionen zu finden, die dies bewerkstelligen.

Oder verfolge ich einen gänzlich falschen Ansatz?

Schönen Gruß,

Falk

### [#6](https://www.typo3.net/d/3795-tip-gmenu-layers-mit-unterschiedlichen-farben/6) · fbrockerhoff · 2004-06-12

*ineckestell
*schäm

special = list löst mein Problem

Danke für's zuhören ;-)

Falk

### [#7](https://www.typo3.net/d/3795-tip-gmenu-layers-mit-unterschiedlichen-farben/7) · doku · 2004-06-12

> **fbrockerhoff schrieb:**
>
> Danke für's zuhören ;-)

oh, bitte, kein thema... ;)  :)  :D

### [#8](https://www.typo3.net/d/3795-tip-gmenu-layers-mit-unterschiedlichen-farben/8) · fbrockerhoff · 2004-06-12

Hmmm,

jetzt habe ich zwar die erste Ebene des Menüs, so wie ich es will - aber wie stelle ich jetzt die jeweils untergeordneten Elemente dar?

Ich möchte diese als TMENU_LAYER als OnMouseOver aufklappendes Menü dargestellt haben, jeweils direkt unter den Hauptmenüpunkten (die jetzt je ein eigenes Menü sind).

Ich hege den starken Verdacht, daß ich bei special = list dies nicht realisieren kann.. Oder kann jemand das Gegenteil behaupten und mir einen Tipp geben?

Gruß,

Falk

### [#9](https://www.typo3.net/d/3795-tip-gmenu-layers-mit-unterschiedlichen-farben/9) · parallaxis · 2004-06-21

> **jean schrieb:**
>
> Since it is technically a second menu you will have some problems with the "expAll"-Option. The Menues will expand, but if you move the Mouse over the second part of the Menu (with the different Colordefinition) it will not collapse. I think i can solve this by setting a timer, but i have not yet continued with that line of thought.

Hoi!
Weiss jemand wie man das lößt?
Weder
hideMenuWhenNotOver = 1
noch
hideMenuTimer 100
funzen bei mir richtig...

mit timer gehts gar nicht, mit WhenNotOver gehts nur wenn ich das untermenü einmal aktiv hatte.

Kann mir bitte wer helfen?

---

Quelle: „TIP - GMENU_LAYERS mit unterschiedlichen Farben“, typo3.net, https://www.typo3.net/d/3795-tip-gmenu-layers-mit-unterschiedlichen-farben
Beiträge von Mitgliedern des Forums. Bitte mit Link auf die Diskussion zitieren.
