Login / Status
developer.Resource
Home . Documentation . Document Library . Core Documentation
Sponsors
hosted by punkt.deTYPO3 and Open Source MagazineAOE Media

7.2. TMENU

The TMENU is a text-based menu. There are lots of examples around. Look in the static_template table. The "content (default)" template has a bunch of examples attached to the tt_content.menu definition.

Here's an example taken from the static_template "TEMPLATE; BUSINESS":

page.10 = HMENU
page.10.1 = TMENU
page.10.1.target = page
page.10.1 {
  expAll = 1
  wrap = <table width="300" border=1 cellspacing=0 cellpadding=0><tr><td><img src="clear.gif" width=1 hspace=200 height=1 vspace=3 border=0></td></tr> | </table>
  NO.linkWrap = <font face=Arial size=2 color=black><b> |</b></font>
  NO.allWrap = <tr><td><img src="clear.gif" width=1 height=1 vspace=3 border=0><br> | </td></tr>
}
page.10.2 = TMENU
page.10.2 {
  wrap = <tr><td nowrap> | </td></tr>
  target = page
  NO {
    beforeImg =  media/bullets/bullet1_n.gif
    beforeROImg = media/bullets/bullet1_h.gif
    beforeImgTagParams = hspace=2
    RO = 1
    after = <br>
    ATagBeforeWrap = 1
    linkWrap= <font face=Verdana size=1 color=black> | </font>
  }
}

Result:

You should know one thing about the TMENU: There are two properties, .before and .after. They have stdWrap properties both and they are actually identical. But - as stated in the TSref - the cObj->data array used by stdWrap's .field property is not loaded with the page-record of the current menu-item when executed. Originally that was a design error, but the workaround in order to be backwards compatible has been that stdWrap can retrieve the field-values of the menu-item page through the .data-property. So instead of "before.field = title" (which gets the main page title) use "before.data = page:title".

Challenge (TMENU/1)

Finetune the menu to your own taste and insert another image-bullet, but insert it to the right of the items!

Challenge (TMENU/2)

Add a third level

Challenge (TMENU/3)

Add a feature that changes the color of the items to red if the item is "active" (that is, if an item is one of the pages in the rootline)

Challenge (TMENU/4)

Create this menu:

Example (TMENU)

This is a screendump from www.fladsaa.dk. The code used for the menu here is found in the Challenge-section in the back, if you would like to see it:



TYPO3 Core API

TSRef

TYPO3 Coding Guidelines