Search code examples
typo3typoscripttt-news

Typo3 tt_news add Parameter to URL


how can i read out the current id from tt_news and add this as a parameter to the url

a small review of my 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 should then look like this: www.example.com/news/news-tech?&tx_events_pi1[newsUid]=55

Updated:

i think this is a problem with the extension mbl_newsevent it shows only news with an registration option and a button with the current tt_news id...generated with this 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
        }  
}

i need the same way for my url....


Solution

  • If I understood correctly, you need to correct your code in a following way:

    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
    }