簡體   English   中英

如何使用RealUrl縮短tx_news詳細信息視圖中的url?

[英]How can I use RealUrl to shorten the url from the tx_news detail view?

我喜歡TYPO3:1000種方式通往羅馬。

以下是我在TYPO3 7.6和tx_news 5.2上提供的詳細視圖中提供的詳細Url的嘗試: http ://pastebin.com/BzgUpsCH

如何從“細節/”中縮短網址

謝謝你的提示。

第一個“羅馬之路”:

plugin.tx_news {
        settings {
                link {
                        skipControllerAndAction = 1
                }
        }
}

第二:

[globalVar = GP:tx_news_pi1|news > 0]
  config.defaultGetVars {
    tx_news_pi1 {
      controller=News
      action=detail
    }
  }
[global]

文檔:

https://docs.typo3.org/typo3cms/extensions/news/3.0.0/Main/Administration/Realurl/Index.html#removing-controller-and-action-arguments-from-url-ii

縮短網址的另一種方法:

在realURL配置文件中使用以下編碼和解碼函數:

  • 'encodeSpURL_postProc'=> array('user_encodeSpURL_postProc'),
    • function user_encodeSpURL_postProc(&$ params,&$ ref){
      $ params ['URL'] = str_replace('News / Details /','News /',$ params ['URL']); }
  • 'decodeSpURL_preProc'=> array('user_decodeSpURL_preProc'),

    • function user_decodeSpURL_preProc(&$ params,&$ ref){
      $ params ['URL'] = str_replace('News /','News / Details /',$ params ['URL']); }

暫無
暫無

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

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