【问题标题】:Typo3 tt_news add Parameter to URLTypo3 tt_news 将参数添加到 URL
【发布时间】:2013-04-10 07:41:42
【问题描述】:

如何从 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
}

网址应如下所示: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
        }  
}

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

【问题讨论】:

  • 我没有收到您的问题。为什么在点击链接之前需要将此参数添加到当前 url?试想一下,当您有一个带有“注册”链接的新闻项目列表时,每个链接都有自己不同的eventUid - 那么当前 URL 中应该是什么?
  • @ViktorLivakivskyi 我更新了我的问题以便更好地理解...我只想知道如何获取 tt_news 的当前 ID...additionalParams = {GP:tx_ttnews|tt_news} ### NEWS- ID 作为 GET 不应该工作,或者我做错了什么

标签: typo3 typoscript tt-news


【解决方案1】:

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

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
}

【讨论】:

  • thx 但它返回 &tx_events_pi1[newsUid]=0 :( 正确的 id 将是 99...查看顶部的更新帖子
  • @Jim 你想在TMENUplugin.tt_news.mbl_newsevent 中获取tt_news uid?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-04-24
  • 2015-06-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多