简体   繁体   English

tt_news列表项上的TYPO3 modyfing img源

[英]TYPO3 modyfing img source on tt_news list item

I'm trying to add additional parameter to tt_news img list source: data-src="path-to-img" . 我正在尝试将其他参数添加到tt_news img列表源: data-src="path-to-img" Is it possible? 可能吗? I try with generic marker but without any success: 我尝试使用通用标记,但未成功:

plugin.tt_news.genericmarkers {
  data = imgsource
  imgsource = TEXT
  imgsource {
    field = image
    wrap = <img src="uploads/pics/|" data-src="uploads/pics/|" />
    file.maxW = 112
    file.maxH = 124
  }
}

But on output I only have this in source: <img src="uploads/pics/img.jpg" data-src="uploads/pics/ without second img source, img size and close tag. 但是在输出中,我仅在源代码中包含此内容: <img src="uploads/pics/img.jpg" data-src="uploads/pics/没有第二个img源,img大小和关闭标签。

Any suggestions? 有什么建议么?

Some remarks before I show you an example: 在向您展示示例之前,请注意以下几点:

  • the »wrap« property only allows one pipe (TYPO3 is replacing the first »|« character with the current value), that why your second parameter is empty »wrap«属性仅允许一个管道(TYPO3用当前值替换第一个»|«字符),这就是为什么第二个参数为空的原因
  • the TEXT objekt only allows value and all properties listed in the »stdWrap« section (see TEXT object: http://docs.typo3.org/typo3cms/TyposcriptReference/ContentObjects/Text/Index.html , list of all stdWrap-properties http://docs.typo3.org/typo3cms/TyposcriptReference/Functions/Stdwrap/Index.html ) TEXT对象仅允许值和»stdWrap«部分中列出的所有属性(请参见TEXT对象: http ://docs.typo3.org/typo3cms/TyposcriptReference/ContentObjects/Text/Index.html,所有stdWrap属性的列表http ://docs.typo3.org/typo3cms/TyposcriptReference/Functions/Stdwrap/Index.html
  • so TEXT does have properties like »wrap« or »case« or »substring«, but no »file« 因此TEXT确实具有»wrap«或»case«或»substring«之类的属性,但没有»file«
  • what you want is an IMAGE object, which allows to manipulate images 您想要的是一个IMAGE对象,它可以处理图像

     plugin.tt_news.genericmarkers { imgsource = IMAGE imgsource { file.import = uploads/pics/ file.import.field = image file.import.listNum = 0 file.width = 250 # if you just want to link the original image params.field = image params.wrap = data-src="/uploads/pics/|" /* # if you want want to manipulate the image as well, then use this code instead # IMG_RESOURCE is almost the same as IMAGE, but returns only the path to the resulting image, not the »<img src="">«-Markup params.cObject = IMG_RESOURCE params.cObject { file.import = uploads/pics/ file.import.field = image file.import.listNum = 0 file.width = 500 stdWrap.wrap = data-src="|" } */ } } 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM