繁体   English   中英

tt_news列表项上的TYPO3 modyfing img源

[英]TYPO3 modyfing img source on tt_news list item

我正在尝试将其他参数添加到tt_news img列表源: data-src="path-to-img" 可能吗? 我尝试使用通用标记,但未成功:

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
  }
}

但是在输出中,我仅在源代码中包含此内容: <img src="uploads/pics/img.jpg" data-src="uploads/pics/没有第二个img源,img大小和关闭标签。

有什么建议么?

在向您展示示例之前,请注意以下几点:

  • »wrap«属性仅允许一个管道(TYPO3用当前值替换第一个»|«字符),这就是为什么第二个参数为空的原因
  • TEXT对象仅允许值和»stdWrap«部分中列出的所有属性(请参见TEXT对象: http ://docs.typo3.org/typo3cms/TyposcriptReference/ContentObjects/Text/Index.html,所有stdWrap属性的列表http ://docs.typo3.org/typo3cms/TyposcriptReference/Functions/Stdwrap/Index.html
  • 因此TEXT确实具有»wrap«或»case«或»substring«之类的属性,但没有»file«
  • 您想要的是一个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