Helmut Winkelbach
Helmut Winkelbach

Reputation: 109

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.

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

How can I shorten the url from "detail/"

Thanks for your hints.

Upvotes: 1

Views: 381

Answers (2)

rob-ot
rob-ot

Reputation: 1264

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

Upvotes: 3

Pravin Vavadiya
Pravin Vavadiya

Reputation: 3207

Another way to short you URL:

use Below encoded and decoded function in realURLconfiguration file:

  • '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']); }

Upvotes: 0

Related Questions