0

我如何从 tt_news 读出当前 id 并将其作为参数添加到 url

对我的 TYPOSCRIPT 的一个小评论

2 = TMENU
2 {
wrap = <ul class="naviMainLevel2"> | </ul>
NO {
wrapItemAndSub = <li> | </li>
}
ACT = 1
ACT {
wrapItemAndSub = <li class="active"> | </li>
#get current tt_news id add it to the menu
additionalParams.data = GP:tx_ttnews|tt_news
additionalParams.intval = 1
additionalParams.wrap = &tx_events_pi1[newsUid]=|
#returns only &tx_events_pi1[newsUid]=0
#maybe is it possible with RECORDS tt_news.mbl_newsevent, to get the id? 
}
CUR = 1
CUR < .ACT
}

url 应如下所示:www.example.com/news/news-tech?&tx_events_pi1[newsUid]=55

更新:

我认为这是扩展 mbl_newsevent 的问题,它仅显示带有注册选项的新闻和带有当前 tt_news id 的按钮...使用此 TS 生成:

plugin.tt_news.mbl_newsevent {
    registrationLink_typolink {
            title.data = LLL:EXT:mbl_newsevent/locallang.xml:registerLinkLabel
            parameter = {$powermail.plugin.pid}
            parameter.override.field = tx_mblnewsevent_regurl
            additionalParams.field = uid
            additionalParams.intval = 1
            additionalParams.wrap = &tx_powermail_pi1[eventUid]=|
                #this returns the correct tt_news id for the button
        }  
}

我的网址需要同样的方式....

4

1 回答 1

2

如果我理解正确,您需要通过以下方式更正您的代码:

2 = TMENU
2 {
  wrap = <ul class="naviMainLevel2"> | </ul>
  NO {
   wrapItemAndSub = <li> | </li>
  }
  ACT = 1
  ACT {
    wrapItemAndSub = <li class="active"> | </li>

    #parameter.override.field = tt_news_id ||uid
    # ^ you don't need this line, becasue you still need 
    # the current page id in url and it shouldn't be overriden
    # by some other param

    # next you need to get current tt_news uid from GET
    # as you mentioned in your comment
    additionalParams.data = GP:tx_ttnews|tt_news
    additionalParams.intval = 1
    additionalParams.wrap = &tx_events_pi1[newsUid]=|
  }
  CUR = 1
  CUR < .ACT
}
于 2013-04-10T16:30:20.323 回答