TYPO3: GMENU with a different image for each menu item

Some while ago I needed to make a GMENU with a different image for each menu item. This was tricky since normally I used CSS to include the image before or behind the menu. After a lot of thinking I realised TYPO3 had a BE field (even a tab!) I had never used; Page properties -> Resources.

So that was it… I included my images for each page here. But than what? How do I call them into my menu? It was quite easy after all… See my typoscript setup!

———————————————————–

# Startingpoint of the menu
temp.menutop.special = directory
temp.menutop.special.value = 83

# The menu:
temp.menutop = HMENU
temp.menutop.1 = GMENU
temp.menutop.1.NO {
altImgResource.import = uploads/media/
altImgResource.import.field = media
altImgResource.import.listNum = 0

# fall back GIFBUILDER item, if no result from altImgResource:
XY = 179,31
backColor = white
10 = TEXT
10.text.field = nav_title // title
10.offset = 10,13
}
temp.menutop.1.RO < temp.menutop.1.NO
temp.menutop.1.RO = 1
temp.menutop.1.RO.altImgResource.import.listNum = 1

temp.menutop.1.ACT < temp.menutop.1.RO
temp.menutop.1.ACT = 1

———————————————————–

Page resources

Page resources

First image = listNum 0
Second image = listNum 1
And so on….

Bookmark and Share

Drop a comment