TYPO3

Formatting the 'Menu/Sitemap' content element

deutsch Hier klicken, um diese Seite auf Deutsch zu lesen: Menü/Sitemap formatieren

Using TypoScript commands, the styles of the various list types of the 'Menu/Sitemap' content element can be reformatted like any other elements to fit the needs of your individual web site.

To give you an example, we will now change the look of the sitemap type 'Menu of subpages to these pages (with abstract)'. This snippet could be used as an automatically generated entry page for subpages that contain articles.

TypoScript: Changing 'Menu of subpages to these pages (with abstract)'

SETUP
# Content element 'Menu of subpages to these pages (with abstract)'
tt_content.menu.20.4 >
tt_content.menu.20.4 < tt_content.menu.20.1
tt_content.menu.20.4.1.wrap = <div class="list">|</div>
tt_content.menu.20.4.1.NO {
  linkWrap = |
  allWrap = <div class="listitem">|</div>
  ATagBeforeWrap = 0
  doNotLinkIt = 1
  stdWrap.htmlSpecialChars = 0
  stdWrap.cObject = COA
  stdWrap.cObject {
    # Link to the subtitle
    10 = TEXT
    10 {
      field = subtitle
      wrap = |<br />
      typolink.parameter.field = uid
    }
    # Format the page title in bold and do not link it
    20 = TEXT
    20 {
      field = title
      wrap = <strong>|</strong><br />
    }
    # Abstract of the linked page
    30 = TEXT
    30 {
      field = abstract
      htmlSpecialChars = 1
      wrap = |&nbsp;
    }
    # Append a 'more' link and put a link on it
    40 = TEXT
    40 {
      value = more ...
      htmlSpecialChars = 1
      wrap = |
      typolink.parameter.field = uid
    }
  }
}

The TypoScript code above generates a link to each subpage and styles these links in the following way:

First, the subtitle of the page will be displayed and linked. In the next line, the page title will be rendered in bold without a link. After that, the abstract of the linked page is written, followed by a 'more' link.

You can define the stylesheet classes as you like. Also, you can use other fields of the pages class (e.g. nav_title instead of subtitle) in the sitemap definition above.

Comments for Formatting the 'Menu/Sitemap' content element

Add a comment


(will not be displayed)


(Fields marked with a * are mandatory)
Please note that your comment will be checked before it gets published.
Latest TYPO3 tutorial
How to define special links with custom tags

How to define special links with custom tags

September 2010 – How you can define your own tags for specific links in TYPO3. We show tags for nofollow links, links to other languages and links to tt_news records. more »

Latest TypoScript snippet
Automated backlink to parent page

Automated backlink to parent page

December 2009 – How to automatically generate a back link to a page one level above the current page. more »

Latest glossary entry
File browsers in TYPO3

File browsers in TYPO3

March 2010 – What are file browsers in TYPO3 and how can they be used? more »