Project

General

Profile

Actions

Bug #64989

closed

Typoscript renderObj IMAGE: empty altText renders "alt" without params in HTML

Added by René Schäfer about 9 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Should have
Category:
TypoScript
Target version:
-
Start date:
2015-02-11
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
5.5
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

Hello together,

I'm praud to report my first bug and you can hopefully recognise what i mean. I found that by rework a picture-menu in Typoscript after upgrade an TYPO3 4.7 to 6.2

It was hard to find the right new way to get pictures out of an typoscript object. I thougt it would be easier as in 4.7. but it was more complex instead..

How ever, her is the code to rende an image:

10 = FILES
10 {
references {
table = tt_content
fieldName = image
}
renderObj = IMAGE
renderObj {
file {
treatIdAsReference = 1
import.data = file:current:publicUrl
}
titleText.data = file:current:title
altText.data = file:current:alternative
}
}

The HTML shows in short:
<img ... alt="What ever.." ...>

BUT if the alternative field if empty, the rendering shows:
<img ... alt ...>

The "alt-Tag" is not properbly deleted. The use of "altText.required=1" does not help.

Thanks for working on TYPO3 in general!
Greetings from Potsdam
René

Actions #1

Updated by Frederic Gaus about 9 years ago

Hi René,

this is intentionally. alt is a required attribute and must not be missing!
http://www.w3schools.com/tags/tag_img.asp

Actions #2

Updated by Frederic Gaus about 9 years ago

I assume that this issue can be closed. @René Fritz: Do you agree?

Actions #3

Updated by Riccardo De Contardi about 9 years ago

I've not understood wheter the problem is that the generated HTML is:

<img scr="whatever.jpg" alt="">

Which - as it has been pointed out by Frederic Gaus - is correct, or:

<img scr="whatever.jpg" alt>

which is wrong AFAIK, as alt is not a boolean attribute
Actions #4

Updated by René Schäfer about 9 years ago

Thanks for responding..

The generated HTML is:

<img scr="whatever.jpg" alt>

The TYPO3 Versions before 6.2 generated

alt="" 

It helps to keep the alt-tag filled by alternatives in Typoscript:

altText.data = file:current:alternative // file:current:name
Actions #5

Updated by Riccardo De Contardi almost 9 years ago

  • Status changed from New to Needs Feedback

can you provide me an example of the code you used?

Actions #6

Updated by Riccardo De Contardi almost 9 years ago

  • Assignee set to René Schäfer

I performed a test with both TYPO3 6.2.12 and 7(latest master), using the code found here http://wiki.typo3.org/File_Abstraction_Layer:

page.10 = FILES
page.10 {
  references {
    data = levelmedia:-1, slide
  }
  renderObj = COA
  renderObj {
    10 = IMAGE
    10 {
    # import Image
    file.import.data = file:current:publicUrl
    # define max width, cropped
    file.width = 430c
    # define max height, cropped
    file.height = 90c
    # define altText
    altText.data = file:current:alternative
    # define titleText
    titleText.data = file:current:title
    # get typolink wrapped around IMG-Tag
    stdWrap.typolink.parameter.data = file:current:link
    }
    20 = TEXT
    20 {
       # define long description
       value.data = file:current:description
       # wrap description
       stdWrap.wrap = <strong>|</strong>
    }
  }
}

In both cases the result is that in the HTML code you have

alt="" 

and not

alt

Are you sure you did not just look at the code generated by Google Chrome's developer tools, which actually reports the alt attribute without the quotes? (but it is the tool that looks wrong, the source code is correct)

Actions #7

Updated by Riccardo De Contardi over 8 years ago

  • Status changed from Needs Feedback to Closed

No feedback within the last 90 days => closing this ticket.

If you think that this is the wrong decision or experience this issue again, then please write to the mailing list typo3.teams.bugs with issue number and an explanation or open a new ticket and add a relation to this ticket number.

Actions

Also available in: Atom PDF