Daniel
Daniel

Reputation: 2467

tt_news: wrap around image including caption?

I am trying to get a wrapper element around an image including its caption in the single view in tt_news for Typo3 6.1. How would I do that? So far I only figured out how to do that for either all images

plugin.tt_news.displaySingle.imageWrapIfAny = ...

or the caption itself

plugin.tt_news.displaySingle.caption_stdWrap.dataWrap = ...

. But I have no clue how to create a wrapper for each single image including its caption...

Thanks in advance!

Upvotes: 0

Views: 2286

Answers (2)

oschloebe
oschloebe

Reputation: 396

I know this is quite old, but as a follow-up that works in TYPO3 6.x you can use:

displaySingle.image.wrap = <div class="news-img">|
displaySingle.caption_stdWrap >
displaySingle.caption_stdWrap.wrap = <p class="news-single-imgcaption">|</p></div>

So each image and caption gets wrapped by <div class="news-img">...</div>

Upvotes: 1

Arek van Schaijk
Arek van Schaijk

Reputation: 1442

The following HTML will be provided by the below TS:

<div class="newsImage">
    <div class="imageHolder">
        <img />
    </div>
    <div class="captionHolder">
        Caption
    </div>
</div>

TypoScript:

displaySingle {

    imageWrapIfAny = <div class="newsImage">|</div>

    image {
        file.maxW >
        file.maxH >
        file.width = 220
        stdWrap.wrap = <div class="imageHolder">|</div>
        altText.field = imagealttext
    }

    caption_stdWrap >
    caption_stdWrap.wrap = <div class="captionHolder">|</div>
}

Upvotes: 0

Related Questions