简体   繁体   English

如何使用RealUrl缩短tx_news详细信息视图中的url?

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

What I like about TYPO3: 1000 ways lead to Rome. 我喜欢TYPO3:1000种方式通往罗马。

Here is my attempt which on TYPO3 7.6 and tx_news 5.2 offers nice Url's in Detail view: http://pastebin.com/BzgUpsCH 以下是我在TYPO3 7.6和tx_news 5.2上提供的详细视图中提供的详细Url的尝试: http ://pastebin.com/BzgUpsCH

How can I shorten the url from "detail/" 如何从“细节/”中缩短网址

Thanks for your hints. 谢谢你的提示。

First "way to rome": 第一个“罗马之路”:

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

Second: 第二:

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

Documentation: 文档:

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

Another way to short you URL: 缩短网址的另一种方法:

use Below encoded and decoded function in realURLconfiguration file: 在realURL配置文件中使用以下编码和解码函数:

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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