1

我正在使用下面的打字稿通过 CONTENT 对象显示新闻内容。一切都很好,除了链接没有转到文章的页面。有没有办法告诉typolink这是一篇新闻文章并且它应该使用缓存的CoolURI链接?

此外,我试图附加到查询字符串的附加参数没有出现。

    temp.MMtest = COA
temp.MMtest {

   10 = CONTENT
   10.table = tt_news
   #10.select.pidInList = 170  # Uid of the sysfolder where News records are stored
   10.select.pidInList = 18
   10.select.recursive = 10
   #10.select.where = uid=10 # Uid of an existing News record
   10.select.andWhere = deleted=0 AND hidden=0
   10.renderObj = COA
   10.renderObj {
     10 = TEXT
     10.field = title
     10.wrap = Title:&nbsp;|<br>
     10.typolink.parameter.field=uid
    typolink.parameter.dataWrap=|
    #typolink.additionalParams.insertData=1
    typolink.additionalParams.data=&my_extra_param=something
    #if.isTrue.field=header
   }
   10.renderObj.20=IMAGE
   10.renderObj.20{
          wrap=|
                            # show it only if inserted
          stdWrap.if.isTrue.field=image
          stdWrap.typolink.parameter.field=uid
          file.import=uploads/pics/
          file.import.field=image
          file.width=100
          file.height=100
   }
 }
4

1 回答 1

2

我不知道,你需要哪些参数,所以简而言之:

10.typolink {
  # you need a page to link too
  parameter = PAGE_ID_OF_SINGLE_VIEW

  # create an cacheable link, that does not depend on cooluri or realurl.
  useCacheHash = 1

  # add the additional params
  additionalParams.wrap = &tx_ttnews[uid]=|

  # data expects special commands
  # "&my_extra_param=something" cannot work on .data
  additionalParams.data = field:uid
}

如果您需要一个以上的额外参数,我会这样做:

10.typolink {
  parameter = PAGE_ID_OF_SINGLE_VIEW
  useCacheHash = 1

  # Create an Content Object Array
  # so you can separat the different entries
  # the cObject will return &tx_ttnews[uid]=123&what[ever]=hardcodedvalue
  # additionalParams is filled with that string and added to the url
  additionalParams.cObject = COA
  additionalParams.cObject {
    10 = TEXT
    10.wrap = &tx_ttnews[uid]=|
    10.field = uid
    20 = TEXT
    20.wrap = &what[ever]=|
    20.value = hardcodedvalue
  }
}

你不需要

10.select.andWhere = deleted=0 AND hidden=0

这是由 CONTENT 对象自动添加的。

阅读有关COAstdWrap及其属性数据的typolink 的更多信息,最后看看getText

于 2013-07-19T15:50:27.623 回答