簡體   English   中英

獲取面包屑的 tt_news 記錄的標題

[英]Obtain the title of tt_news record for breadcrumb

以下代碼運行良好,直到 TYPO3 7.6 LTS。 它檢查當前 tt_news 記錄的標題並將其寫入 lib.breadcrumb。 從 TYPO3 版本 8.x 開始,代碼獲取所有現有 tt_news 記錄的標題。

所以我試圖修改代碼以便只獲得當前新聞項目的標題。 使用靜態數字 (uidInList = 2) 可以正常工作:它獲取 UID=2 的 tt_news 記錄的標題。

但是我想動態獲取由其 ID 標識的當前新聞記錄的標題。 selectandWhere之間,我插入/評論了幾種可能性。 他們都沒有工作。

有什么建議? 謝謝!

[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]

我很久以前就停止使用 tt_news 並轉換為EXT:news ,所以我只是猜測。

正如您已經注意到的,以前提取當前新聞記錄的 uid 不再有效。 可能是因為 URL 參數已更改。

嘗試通過停用 realurl 來識別新參數,並查找生成的 URL 以在詳細信息視圖中顯示新聞。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM