如何通过打字稿获取tx_news中的视频URL(标签关系)?

时间:2019-04-09 10:55:59

标签: typo3 typoscript tx-news

  1. 我在tx_news中创建了一个新项目。
  2. 我在此项目中添加了一个媒体文件(按Tab键关联),作为media-url-youtube。
  3. 我想按拼写输入此youtube视频的网址。

如果我在第2步中添加了一个图片文件(而不是媒体文件网址),则可以使用以下代码获取图片网址

page.headerData.87 >
page.headerData.87 = COA

page.headerData.87.1 = COA
page.headerData.87.1.1 = TEXT
page.headerData.87.1.1.value = <meta property="og:image"             
content="http://www.MyHomePage.com/
page.headerData.87.1.2 =COA
page.headerData.87.1.2 {

5=RECORDS
5 {


  dontCheckPid = 1
  tables = tx_news_domain_model_news
  source.data = GP:tx_news_pi1|news
  source.intval = 1
  conf.tx_news_domain_model_news = FILES
  conf.tx_news_domain_model_news {
    references {
      table = tx_news_domain_model_news
      fieldName = fal_media
      uid.field = uid
    }
    begin = 0
    maxItems = 1
    renderObj = IMG_RESOURCE
    renderObj.file {
      maxW = 1200
      import.data = file:current:publicUrl
      treatIdAsReference = 1
    }
  }




}
}
page.headerData.87.1.3 = TEXT
page.headerData.87.1.3.value = " />

但是,如果在第2步中添加了Youtube-Video,它就无法正常工作。

我应该如何更改打字稿以实现这一目标?

谢谢

1 个答案:

答案 0 :(得分:1)

已解决

temp.videofilename = COA
temp.videofilename.1 = TEXT
temp.videofilename.1.value = fileadmin

temp.videofilename.2 = CONTENT
temp.videofilename.2 {
    if.isTrue.data = GP:tx_news_pi1|news
    table = tx_news_domain_model_news
    select {
        uidInList.data = GP:tx_news_pi1|news
        pidInList = 87
        # 87 is a folder with Your News
        join = sys_file_reference ON tx_news_domain_model_news.uid = sys_file_reference.uid_foreign JOIN sys_file ON sys_file.uid = sys_file_reference.uid_local
        where sys_file.mime_type = 'video/youtube' AND sys_file_reference.deleted = 0
        orderBy = sys_file_reference.sorting
        max = 1
    }
    renderObj = TEXT
    renderObj {
        field = identifier
    }
}

page.headerData.89.85 = COA
page.headerData.89.85.1 = TEXT
page.headerData.89.85.1.value = <meta property="og:video" content="https://youtu.be/
page.headerData.89.85.2 =COA
page.headerData.89.85.2 {
5 = FILE
5.file.cObject < temp.videofilename
}
page.headerData.89.85.3 = TEXT
page.headerData.89.85.3.value = " />