[Typo3] Userdefined menu not displaying correctly

cjackson at firstambank.com cjackson at firstambank.com
Mon Aug 8 20:10:41 CEST 2005





Ok, I'm trying to create a menu system not based on pages in the tree. In
the HMENU documentation, I read about the "special=userfunction" property
of the GMENU, so I tried using that. Here's the code in the root template:

subparts.MENU = HMENU
subparts.MENU.entryLevel = 1
subparts.MENU.stdWrap.required=1
subparts.MENU.stdWrap.wrap = <TABLE WIDTH="135" BORDER="0" CELLPADDING="1"
CELLSPACING="0" BGCOLOR="cccccc"><TR><TD><TABLE WIDTH="135" BORDER="0"
CELLPADDING="0" CELLSPACING="0" BGCOLOR="cccccc"> |
</TABLE></TD></TR></TABLE>
subparts.MENU.1 = GMENU_LAYERS
subparts.MENU.1.expAll=1
  # subparts.MENU.1.min = 135,15
subparts.MENU.1 {
  layerStyle = position:absolute;left:
145px;top:135px;width:10px;VISIBILITY:hidden;
  yPosOffset =-100
  lockPosition = y
  hideMenuWhenNotOver = 10
  hideMenuTimer = 1000
  dontHideOnMouseUp = 0

NO {
  wrap = |*||*|<TR><TD WIDTH="135" HEIGHT="15">|</TD></TR><TR> <TD
HEIGHT="1"><IMG SRC="fileadmin/HOME/shim.gif" WIDTH="1"
HEIGHT="1"></TD></TR>||<TR><TD WIDTH="135" HEIGHT="15">|</TD></TR>
  XY = 135,[20.h]+15
  backColor = #FFFFFF


  #First section
  10 = TEXT
  10.text.listNum = 0
  10.text.listNum.splitChar = |
  10.text.field = title
  10.fontColor = #000000
  10.font = t3lib/fonts/verdana.ttf
  10.offset = 4,9
  10.niceText = 1
  10.fontSize = 9

  #Second section
  20 = TEXT
  20.text.listNum = 1
  20.text.listNum.splitChar = |
  20.text.field = title
  20.fontColor = #000000
  20.font = t3lib/fonts/verdana.ttf
  20.offset = 4,18
  20.niceText = 1
  20.fontSize = 9
}

RO < NO
RO=1
RO {
  XY = 135,[20.h]+15
  backColor = #FFCC33
  #First section
  10 = TEXT
  10.text.listNum = 0
  10.text.listNum.splitChar = |
  10.text.field = title
  10.fontColor = #000000
  10.font = t3lib/fonts/arial.ttf
  10.offset = 4,9
  10.niceText = 1
  10.fontSize = 9

  #Second section
  20 = TEXT
  20.text.listNum = 1
  20.text.listNum.splitChar = |
  20.text.field = title
  20.fontColor = #000000
  20.font = t3lib/fonts/verdana.ttf
  20.offset = 4,18
  20.niceText = 1
  20.fontSize = 9
}
IFSUB < NO
IFSUB=1
IFSUB {
  wrap = |*||*|<TR><TD WIDTH="135" HEIGHT="15">|</TD></TR><TR> <TD
HEIGHT="1"><IMG SRC="fileadmin/HOME/shim.gif" WIDTH="1"
HEIGHT="1"></TD></TR>||<TR><TD WIDTH="135" HEIGHT="15">|</TD></TR>
  XY = 135,[20.h]+15
  backColor = #FFFFFF

  #First section
  6 = IMAGE
  6.file = fileadmin/HOME/tri_off.gif
  6.align = r
  10 = TEXT
  10.text.listNum = 0
  10.text.listNum.splitChar = |
  10.text.field = title
  10.fontColor = #000000
  10.font = t3lib/fonts/arial.ttf
  10.offset = 4,9
  10.niceText = 1
  10.fontSize = 9

  #Second section
  20 = TEXT
  20.text.listNum = 1
  20.text.listNum.splitChar = |
  20.text.field = title
  20.fontColor = #000000
  20.font = t3lib/fonts/verdana.ttf
  20.offset = 4,18
  20.niceText = 1
  20.fontSize = 9
}
IFSUBRO < IFSUB
IFSUBRO=1
IFSUBRO {
  XY = 135,[20.h]+15
  backColor = #FFCC33

  #First section
  6 = IMAGE
  6.file = fileadmin/HOME/tri_off.gif
  6.align = r
  10 = TEXT
  10.text.listNum = 0
  10.text.listNum.splitChar = |
  10.text.field = title
  10.fontColor = #000000
  10.font = t3lib/fonts/verdana.ttf
  10.offset = 4,9
  10.niceText = 1
  10.fontSize = 9

  #Second section
  20 = TEXT
  20.text.listNum = 1
  20.text.listNum.splitChar = |
  20.text.field = title
  20.fontColor = #000000
  20.font = t3lib/fonts/verdana.ttf
  20.offset = 4,18
  20.niceText = 1
  20.fontSize = 9
}
}

I added the following code to the template on the page itself:

includeLibs.user_menu = fileadmin/user_menu_coe.php

page.10 {
   subparts.MENU.special = userfunction
   subparts.MENU.special.userFunc = user_menu_coe->makeMenuTest

And then in the makeMenuTest function, I just did a straight copy of the
php code they used to generate a menu in the documentation:

http://typo3.org/documentation/document-library/doc_core_tsref/HMENU-1/

When I load the page up, the top level of the menu is there, but there's no
link to the pages and the submenus don't appear.

Also, I'm working in version 3.5. I tried it in 3.8 and the links worked,
but the submenus still didn't display.

Is this a problem with my template definition? I suspect it is, but I don't
know what it is that's wrong.

Charlie Jackson



More information about the TYPO3-english mailing list