How to add an id to image in typo3?

539 Views Asked by At

I am struggling with typo3. I want to add a default id to a particular image uploaded in a section by user.

My backend layout create a section with colPos = 1.
In this section user can upload one image, which will have id of

bg-img

I have cleared default rendering of image by this code:

tt_content.image.20.1.layout.default.element = <img src="###SRC###" ###ALTPARAMS###>

My template code is like this:

page.10.subparts {

       HEADERIMG<styles.content.get
       HEADERIMG.select.where = colPos= 1

}

How to do that?

1

There are 1 best solutions below

0
On

I don´t think having multiple images with the same id on a page is correct HTML, as ID´s should always be unique per page. Use the class attribute instead. With the following code you can specify image params.

tt_content.image.20.1.params = class="my-class" id="bg-img"