HowardK
HowardK

Reputation: 27

Typo3: How to insert the page title automatically into an img alt tag and into rtetextarea

Say we have a Text/Images record and go to "Images & Captions" and then to "Alternative Labels (one per line)".

I would like something like this: "this is the alt image info for {page:title}."

Using {page:title} in the "main" page elements like "General>Header" works, but not for "Images>Alternative Labels (one per line)"

Also, would the solution to the above work similarly "{page:title}" in the RTEtextarea?

Upvotes: 1

Views: 1244

Answers (2)

maholtz
maholtz

Reputation: 3631

This lines of coude should do the same thing.

tt_content.image.20.1.altText.append = TEXT
tt_content.image.20.1.altText.append {
   noTrimWrap = | ||
   data = page:title
}

If the editor should be able to set {page:title} of its own, just set

tt_content.image.20.1.altText.insertData = 1

Upvotes: 0

konsolenfreddy
konsolenfreddy

Reputation: 9671

If I understood your question correctly, this will do:

temp.altText >
temp.altText < tt_content.image.20.1.altText
tt_content.image.20.1.altText >
tt_content.image.20.1.altText.cObject = COA
tt_content.image.20.1.altText.cObject {
    10 < temp.altText
    20 = TEXT
    20 {
        noTrimWrap = | | |
        data = page:title
    }
}

It uses the original alt attributes and appends the page title of the current page. I don't know about a way to accomplish that in inline RTE images though. The alt text is set within the sourcecode, image tags are not specifically parsed by lib.parseFunc_RTE during the rendering process

Upvotes: 1

Related Questions