blog.Resource

Archive:

News-Feeds:


RSS 2.0
RSS 0.91
RDF
ATOM 0.3
July 4, 2010

Fun with menus

Category: Mathias Schreiber

By: Mathias Schreiber

On T3DD10 I showed some of the possibilities of HMENU and TMENU in order to build some teasers. The basic idea is to reduce the number of extensions in the system while maintaining a great deal of flexibility. And the best part: It has been in TYPO3 for almost 10 years.

First off, let me apologize for the 3 month delay, I've been incredibly busy the past view months and to be honest... I simply forgot I started this blog post during T3DD back in July, so don't blame yourself for not seeing it the past couple of months. Also: Forget the date above, this article has gone live on Oct. 21st.

Imagine the following scenario:

You client wants to have teasers on his website. Teasers should of course be editable by a normal editor without having access to the pages where the teasers themselves are located. This part of the setup is the task of the editor-in-chief.

In case you don't already know:
Every extension slows TYPO3 down a bit - whether you use it on a specific page or not.
Plus, by the time of this writing, every extension will increase memory consumption by a notable amount at EVERY request to a frontend page - no matter if the content is cached or not.

You could use TemplaVoila for this task but maybe you don't want to change the way your editors work or from a techy point-of-view you don't like the way data is saved on TV or the teasers should be on the root-page and you don't want to fiddle around with permissions to get it going.

This is a short breakdown of what I did:

  1. Remove all previous default TS from CSS Styled Content
  2. Redefine a new HMENU
  3. Use special = list
  4. Set the special.value field to "pages" - This is the fieldname in tt_content that is used by the sitemap element to store the relations
  5. Use "doNotShowLink = 1" to suppress the rendering of ANY links (thus we have nothing)
  6. Use NO.before.cObject = COA to build do your thing

 

Here is some sample code I did using DAM - please notice I used parts of the predefined code from CSS styled Content, which basically does what I want and I'm a madman in regards of performance so yes... shorter TS Template WILL speed up your website (though in most cases you won't notice it anyways :))

tt_content.menu.20.default.wrap >
tt_content.menu.20.default.1 >
tt_content.menu.20.default {
  wrap = <div class="teaserbox">|</div>
  1 = TMENU
  1.NO.allWrap = <div class="singleteaser">|</div> #optionSplit rules at this place
  1.NO.doNotLinkIt = 1
  1.NO.doNotShowLink = 1
  1.NO.before.cObject = COA
  1.NO.before.cObject {
    10 = IMAGE
    10.file {
      import.cObject = USER
      import.cObject.refTable = pages
      import.cObject.refField = media
      import.cObject.userFunc = tx_dam_tsfe->fetchFileList
      import.listNum = 0
      width = 192c-100
      height = 117
    }
    20 = TEXT
    20.field = title
    20.wrap = <h2>|</h2>
    30 = TEXT
    30.field = abstract
    30.wrap = <p>|</p>
    40 = TEXT
    40.value = {$more} &raquo;
    40.wrap = <p class="morelink">|</p>
    40.typolink.parameter.field = uid
  }
}

 

 


comments

No comments yet. Be the first to comment on this!

Sorry, comments are closed for this post.