简体   繁体   中英

Obtain the title of tt_news record for breadcrumb

the following code worked well until TYPO3 7.6 LTS. It checked for the title of the current tt_news record and wrote it to lib.breadcrumb. Up from TYPO3 version 8.x the code obtains the titles of ALL existing tt_news records.

So I tried to modify the code in order get only the title of the CURRENT news item. Using a static number (uidInList = 2) works fine: it gets the title of tt_news record with UID=2.

However I want dynamically obtain the title of the current news record identified by its ID. Between select and andWhere I have inserted/commented several possibilities. None of them works out.

Any suggestions? THANKS!

[globalVar = GP:tx_ttnews|tt_news > 0]
  lib.breadcrumb.20 = CONTENT
  lib.breadcrumb.20 {  

    table = tt_news    
        select {
          pidInList = 89 

          #Works well with static number - this generates 
          #the output of the title of news with uid=2:
          #uidInList = 2          

          #However we do want to create a dynamic output 
          #of the title of the currently selected tt_news article 
          #(doesn't work):
          uidInList.field = uid

          #This doesn't work either:
          #uidInList = GP:tt_news[uid]
          #uidInList = GP:tt_news|uid
          #uidInList.data = GP:tt_news[uid]
          #uidInList = tt_news.uid

            andWhere{
                data = GP:tx_ttnews|tt_news
                wrap = uid = |                         
            }
            languageField = sys_language_uid
        }
        renderObj = COA        
        renderObj {
            10 = TEXT
            10 {
                stdWrap.override.field = title               
            }
        }
    }
  }
[end]

I stopped using tt_news long ago and converted to EXT:news , so I only guess.

As you already noticed is the formerly extraction of theuid of the current news record no longer working. Probably because the URL parameter has changed.

Try to identify the new parameter with a deactivation of realurl and look for the generated URLs for displaying a news in detail view.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM