简体   繁体   中英

link an image in tt_news

I'm using TYPO3 4.2.8 and tt_news 2.5.2. I tried the following snippet :

plugin.tt_news.displaySingle {
    image {
        # turn off default popup anchor
        imageLinkWrap = 0
        # add our link to the first URL in links field
        stdWrap.typolink {
            parameter = {current:1}
            parameter {
            setCurrent.field = links
            setCurrent.listNum = 0
                insertData = 1
        }
        }
    }
}

Then I added an image to my news and also put a link into the link field (in the tab relations).

<LINK http://www.yourwesite.com/fileadmin/user_upload/downloads/broschure.pdf _blank>Download brochure</LINK>

But if I look at the news I don't have a link on the image. What do I have to change to get it work with my old version of tt_news?

Edit:

Now I tried it with gernericmarkers (idea from this topic ). My TS looks like the following:

temp.img = COA
temp.img.5 = IMAGE
temp.img.5 < plugin.tt_news.displaySingle.image
temp.img.5 {
    required = 1
    wrap = |
    file {
        import = uploads/pics/
        import.field = image
        import.listNum = 0
    }
    titleText.field = title
    altText.field = title
    if.isTrue.field = links
    imageLinkWrap.typolink.parameter.data = field:links
}

plugin.tt_news.genericmarkers.imagewithlink < temp.img

The marker is working but there is no content displayed in the news. What is wrong with my TS?

我不知道这是否适用于您的旧tt_news版本,但至少从3.0+版本起,您可以<!--###LINK_ITEM###--> around your image <!--###LINK_ITEM###-->使用标记<!--###LINK_ITEM###--> around your image <!--###LINK_ITEM###-->模板内的<!--###LINK_ITEM###--> around your image <!--###LINK_ITEM###-->将您喜欢的任何内容链接到详细信息页面。

Your first snippet works, but you have to insert the link without the tags into the link field. eg

http://www.yourwesite.com/fileadmin/user_upload/downloads/broschure.pdf _blank

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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