TYPO3 / Typoscript:从页面属性中获取媒体

时间:2018-01-04 12:45:15

标签: typo3 typoscript typo3-6.2.x

我正在使用Typo3 6.2并且我在“资源”字段中有一个上传媒体(图片)的页面t:

enter image description here

我正试图在我的Typoscript中获取图片,我相信我必须使用像{field:something_here}这样的属性,但我不知道chich one?

编辑:

我已经尝试过这个,没有成功(没有生成任何内容):

    5 = FILES
    5 {
    references.data = levelmedia:-1,slide
    references.listNum = 0
    renderObj = TEXT
    renderObj.data = file:current:publicUrl
    }

和此:

    5 = FILES
    5 {
        references {
        table = pages
        uid.data = page:uid
        fieldName = ogimage
        }
        maxItems = 1
        renderObj = TEXT
        renderObj {
        data = file:current:uid
        }
        }
    }

和此:

    5 {
        file.import.data = levelmedia: -1, slide
        file.import = fileadmin/user_upload/
        file.import.listNum = 0
        file.import.override.field = media
    }

..上面这段代码会生成一张图片(http://www.mycompany.com/typo3conf/ext/news/Resources/Public/Icons/news_domain_model_news_add.png)但不是好消息!

1 个答案:

答案 0 :(得分:2)

问题解决了!

经过几个小时或研究后,我发现了一个工作片段:

5=FILES
5.begin = 0
5.maxItems = 1
5.references.table = pages
5.references.uid.data = uid
5.references.fieldName  = media
5.renderObj = TEXT
5.renderObj {
    data = file:current:publicUrl
    wrap = <div class="image-section" style="background-image:url('/|')">&nbsp;</div>
}