accessible GTMenu


/ Published in: TYPO3
Save to your folder(s)

Using this TypoScript, you can build an accessible GTMenu which may fully be styled using CSS. We propose using this instead of ANY GMENU which creates ugly code.

It renders a simple TMENU, and wraps an IMG_RESOURCE into the ATagParams by making this a cObject. Check out the podcast on typo3.org: http://castor.t3o.punkt.de/files/TnT_ttmenu.m4v

Please note: in order to use {TSFE:lastImgResourceInfo|0} (which reads the width of the last image generated by the gifbuilder) you need TYPO3 4.1


Copy this code and paste it in your HTML
  1. ### TypoScript ###
  2.  
  3. lib.gtmenu = HMENU
  4. lib.gtmenu {
  5. 1 = TMENU
  6. 1 {
  7. wrap = <ul id="navi">|</ul>
  8. NO.doNotLinkIt = 1
  9. NO.wrapItemAndSub = <li>|</li>
  10. NO.stdWrap.cObject = COA
  11. NO.stdWrap.cObject {
  12. 10 = TEXT
  13. 10 {
  14. field = title
  15. parameter.field = uid
  16.  
  17. ATagParams.cObject = COA
  18. ATagParams.cObject {
  19.  
  20. 10.file = GIFBUILDER
  21. 10.file {
  22. XY = [10.w]+[20.w]+10,70
  23. transparentColor = #ffffff
  24. 10 = TEXT
  25. 10 {
  26. text.field = subtitle//title
  27. fontSize = 14
  28. fontFile=fileadmin/fonts/DINPro-Bold.otf
  29. offset = 5,20
  30. fontColor = #787879
  31. }
  32.  
  33. 20 = BOX
  34. 20.dimensions = 0,30,[10.w]+[20.w]+10,30
  35. 20.color = #e53827
  36.  
  37. 30 = TEXT
  38. 30 < .10
  39. 30 {
  40. offset = 5,50
  41. fontColor = #ffffff
  42. }
  43. }
  44. 10.stdWrap.dataWrap = style="width:{TSFE:lastImgResourceInfo|0}px; background-image: url('/|');"
  45. }
  46. }
  47. }
  48. }
  49. }
  50. }
  51.  
  52.  
  53.  
  54. ### CSS ###
  55.  
  56. ul#navi {list-style: none;}
  57. ul#navi li {float: left;}
  58. ul#navi li a {background-repeat:no-repeat; display:block; overflow:hidden;text-indent: 999em; white-space:nowrap; height:30px;}
  59. ul#navi li a:hover, ul#navi li.current a,ul#navi li.over a {background-position:0px -30px;}

URL: http://www.gtmenu.de

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.