Talk:GTMENU
From TYPO3Wiki
Very good work! I always thougt about a solution like this. Just some small things:
1. Preloading the images without javascript displays them before the menue. This is not an option for an accessible website. So I recommend to display them at the very end of the page with html attributes height="1" and width="1".
2. It is not neccassary to preload the normal state images of the menu - they will be displayed by the menue itself.
3. The image replacement method completely fails if images are turned off - you can use the solution from Richard Rutter (http://www.clagnut.com/blog/1451/) or this: http://levin.grundeis.net/files/20030809/alternatefir.html .
Thanks, Kai
Hello Kai, thanks for your feedback and your suggestions. After some basic tests the first IR method seems best for GTMENU. The concept itself needs some rethinking and further improvement. Doing it with an IProcFunc restricts the method too much to the context of being executed while the menu is rendered. Besides your observations, this results in a huge number of temporary css and js files - they are written each time the engine loops through the IProcFunction (basically for every existing menu item :/.
Though the current version is okay as a proof of concept, I'll see to remodelling this as an extension to class.tslib_menu.php. I already have some user extension of mine that does some TS improvements on menus via XCLASS - this will be an easy way to test things...
--
I have a much nicer solution to the rollover problem, using pure CSS rollovers with one image per NO/RO set. This requires some external CSS though.
The way I do it is to put the rollovers in a div that has overflow hidden and a fixed height, and use the background-position to shift a single background image from GTMENU up or down. I use the standard GMENU typoscript to generate a double-height image for each entry:
lib.mainnav {
entryLevel = 1
wrap = <ul>|</ul>
1 = GMENU
1 {
noBlur = 1
css2TempFile = 1
NO {
wrap = <li>|</li>
XY = [1.w],35
backColor = #0555A4
1 = TEXT
1 {
text.field = title
offset = 0,15
fontFile = fileadmin/templates/fonts/SuDuCSH.ttf
fontColor = white
fontSize = 11
niceText = 1
antiAlias = 1
}
# rollover
2 = TEXT
2 {
text.field = title
offset = 0,32
fontFile = fileadmin/templates/fonts/SuDuCSH.ttf
fontColor = #FFE300
fontSize = 11
niceText = 1
antiAlias = 1
}
}
}
}
lib.mainnav.1.IProcFunc = user_gtmenu->GTMenu
You can see the effect of this in the main nav of http://www.getthru.govt.nz
Very clean!
Also, bugfix, the title needs to be escaped like this:
$I["parts"]["image"]=htmlspecialchars($I["title"]);
Nbertram 03:37, 16 October 2006 (CEST)
If you use this to generate submenus, it is good to use wrapItemAndSub. But this is not possible in gmenu. I vote for core change: copy content from tslib_tmenu::extProc_afterLinking into tslib_gmenu::extProc_afterLinking. --213.151.244.17 10:22, 5 August 2008 (CEST)
