TYPO3在tt_news列表项上创建了img源代码

时间:2014-08-14 07:52:34

标签: typo3 typoscript tt-news

我尝试向tt_news img list source添加其他参数: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大小和关闭标记。

有什么建议吗?

1 个答案:

答案 0 :(得分:0)

在我向您展示一个例子之前的一些评论:

  • »wrap«属性只允许一个管道(TYPO3用当前值替换第一个»|«字符),这就是你的第二个参数为空的原因
  • TEXT objekt只允许在»stdWrap«部分列出的值和所有属性(参见TEXT对象:http://docs.typo3.org/typo3cms/TyposcriptReference/ContentObjects/Text/Index.html,列出所有stdWrap-properties 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="|"
            }
            */
        }
    }