开发者

How do I achive to dataWrap only the first image?

This snippet...

tt_content.stdWrap.innerWrap >
tt_content.textpic.stdWrap.innerWrap = <li style="background:url({TSFE:baseUrl}uploads/media/{field:image})">|</li>
tt_content.textpic.stdWrap.innerWrap.insertData = 1

...does actually work fine. The result is:

<li style="background:url(www.mysite.com/uploads/media/cool.jpg,overlay.png,firstimage.png)">...</li>

Well...

www.mysite.com/uploads/media/ cool.jpg, overlay.png, firstimage.png

...as you can see above. It actually reads all available images (3 images in this case) from the content object's media field. But I want only the first image. (which should be image 0, firstimage.png)

Is there a way to achive this with a command like this pseudo code: {field:image:0}, {fie开发者_C百科ld:image,1}, {field:image, listNum:1}?

Thank you for your advice. = )


Did you examine the import function of stdWrap?

http://typo3.org/documentation/document-library/core-documentation/doc_core_tsref/4.5.1/view/1/5/#id2618274

Citing:

This returns the first image in the field "image" from the data-array:

.import = uploads/pics/

.import.field = image

.import.listNum = 0

You would of course need to change the import folder to uploads/media, and wrap your li tag around the result, but you should get the item you want this way.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜