Hallo,
ich verändere über TypoScript den ALT-Text von Bildern:
Typoscript-Code:
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38:
| tt_content.image.20.1.altText > tt_content.image.20.1.altText = TEXT tt_content.image.20.1.altText { cObject = TEXT cObject { field = altText split { token.char = 10 returnKey.data = register : IMAGE_NUM_CURRENT } } ifEmpty.cObject = TEXT ifEmpty.cObject { field = image listNum.stdWrap.data = register : IMAGE_NUM_CURRENT split { token.char = 95 cObjNum = 1 |*| 1 |*| 2 1.current = 1 1.noTrimWrap = || | 2.cObject = TEXT 2.cObject.current = 2 2.cObject.split { token.char = 46 cObjNum = 1 |*| 2 1.current = 1 } } } } |
Wenn ein Wert im ALT-Feld gesetzt ist, wird dieser genommen, ansonsten wird der Bildname verwendet. Vor Verwendung wird der Bildname noch "schön" gemacht, aus "lorem-ipscream_08.jpg" wird "lorem-ipscream 08":
HTML-Code:
<a target="thePicture" onclick="openPic('http://xxx/typo3_basic/www/index.php?eID=tx_cms_showpic&file=uploads%2Fpics%2Florem-ipscream_08.jpg&width=800m&height=600m&bodyTag=%3Cbody%20style%3D%22margin%3A0%3B%20background%3A%23fff%3B%22%3E&wrap=%3Ca%20href%3D%22javascript%3Aclose%28%29%3B%22%3E%20%7C%20%3C%2Fa%3E&md5=0bb603fc7ede8314c6529db3dc9acd3f','thePicture','width=450,height=349,status=0,menubar=0'); return false;" href="index.php?eID=tx_cms_showpic&file=uploads%2Fpics%2Florem-ipscream_08.jpg&width=800m&height=600m&bodyTag=%3Cbody%20style%3D%22margin%3A0%3B%20background%3A%23fff%3B%22%3E&wrap=%3Ca%20href%3D%22javascript%3Aclose%28%29%3B%22%3E%20%7C%20%3C%2Fa%3E&md5=0bb603fc7ede8314c6529db3dc9acd3f"> <img width="129" height="100" border="0" alt="lorem-ipscream 08" src="typo3temp/pics/lorem-ipscream_08_c1f2c164bd.jpg"/> </a> Nun hab ich mir die Extension wsclicklightbox installiert, die alle "Klick-vergrößern"-Bilder in einer Lightbox öffnet. Doch diese Extension funktioniert nicht, und zwar wegen meiner TS-Zeile "token.char = 95". Wenn ich diese rausnehme, sieht der HTML-Code wie gewünscht aus, nur das ALT-Attribut ist eben nicht gesetzt wie gewünscht:
HTML-Code:
<a rel="lightbox[c413]" target="_self" href="uploads/pics/lorem-ipscream_08.jpg"> <img width="129" height="100" border="0" alt="lorem-ipscream_08.jpg" src="typo3temp/pics/lorem-ipscream_08_c1f2c164bd.jpg"/> </a>
Woran könnte das liegen? Hier ist der TS-Code von wsclicklightbox:
Typoscript-Code:
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37:
| tt_content.image.20.1.imageLinkWrap { typolink > typolink { parameter.cObject = IMG_RESOURCE parameter.cObject.file { import.current = 1 width = {$styles.content.imgtext.linkWrap.width} height = {$styles.content.imgtext.linkWrap.height} effects = {$styles.content.imgtext.linkWrap.effects} } parameter.postCObject = LOAD_REGISTER parameter.postCObject { INCLUDE_PROTOTYPE = 1 INCLUDE_SCRIPTACULOUS = effects INCLUDE_LIGHTBOX = 1 } parameter.override { field = image_link listNum.stdWrap.data = register : IMAGE_NUM_CURRENT } ATagParams = rel="lightbox[c{field:uid}]" ATagParams.insertData = 1 ATagParams.if.isFalse < .parameter.override target = {$styles.content.links.target} extTarget = {$styles.content.links.extTarget} } } |
Gruß Sven