jensgram
jensgram

Reputation: 31518

"Menu of subpages of selected pages including abstracts" with first image from page

Current state

On a site, I am currently using the Menu of subpages of selected pages including abstracts variant of the Sitemap element to create a list of subpages:

Subpage 1
Abstract from subpage 1

Subpage 2
Abstract from subpage 2

This is all very well — and easy to do via TypoScript:

lib.somethingsomething = COA
lib.somethingsomething {
    ...
    30 < tt_content.menu.20.4
    ...
}

Desired state

What I would like is the abstract to include an image from the page (preferably the first image from the first tt_content on the page). Like so:

Subpage 1
[IMG-X] Abstract from subpage 1

Subpage 2
[IMG-Y] Abstract from subpage 2

What I have found so far is the thread subpages with image on Typo3 MailArchive. However, I do not have the DAM extension that they use. However, I can see that tt_content.menu.20.4 is just a HMENU with a TMENU of type directory:

tt_content.menu.20.4 = HMENU # "Menu of subpages to these pages (with abstract)"
tt_content.menu.20.4 {
    1 = TMENU
    1 {
        target = 
        NO {
            stdWrap.htmlSpecialChars = 1
            ATagTitle.field = description // title
            linkWrap = <dt>|</dt>
            after {
                data = field : abstract // field : descr...
                required = 1
                htmlSpecialChars = 1
                wrap = <dd>|</dd>
            }
        }
        noBlur = 1
    }
    special = directory
    special.value.field = pages
    wrap = <dl class="csc-menu csc-menu-4">|</dl>
}

Does anyone know of a way to achieve this, be it an extension, a piece of TS etc.?

Upvotes: 1

Views: 3313

Answers (1)

user673046
user673046

Reputation:

here's a typical Typo3 teaser snippet used to load the first image of the current page to be displayed. You sure can use something similar with navigational elements.

lib.teaser = IMAGE
lib.teaser {
  #this is the default image, for pages with no specific image add
  file = fileadmin/template/gfx/test_header1.jpg

  #if the selected page has an added image, the set this instead of the default above
  file.import.override.field = media

  #fetch image from the upload/media/ folder
  file.import.data = levelmedia: -1, "slide"
  file.import = uploads/media/

  #lock the configuration to use only the first added image
  file.import.listNum = 0
}

cu Roman

Upvotes: 0

Related Questions