tx_news call a single news item withouth the hash

713 views Asked by At

A typical news call looks like:

http://myurl/?tx_news_pi1%5Bnews%5D=4916&tx_news_pi1%5Bcontroller%5D=News&tx_news_pi1%5Baction%5D=detail&cHash=ef6e70673f8c8be5eddd03ad8bb8e220

I would like to change the uid in the frontend, but it does not work when I dont have the right hash for it. Is it possible to call a newsitem just by the uid or is it possible to create the hash in the frontend? Like

http://myurl/?tx_news_pi1%5Bnews%5D=9999&tx_news_pi1%5Bcontroller%5D=News&tx_news_pi1%5Baction%5D=detail

while 9999 will be replaced with my uid?

1

There are 1 answers

2
lorenz On

Yes, the cHash (Cache Hash) is related to the caching mechanism in TYPO3. The only way to get rid of it while keeping the cache mechanism working is to use RealURL. RealURL handles the cHash internally and therefore won't display it.

The default RealURL config for News can be found here.

This will generate a link such as http://mydomain.tld/news/detail/news-title where news-title is the lowercase and space-free version of the title. If you want the UID of the news record as identifier, you can change the configuration by replacing

'alias_field' => 'title',

by

'alias_field' => 'uid',

Then clear the cache and your UIDs will be generated as configured.

You can also combine title and uid by using MySQL functions, e.g.:

'alias_field' => 'CONCAT(SUBSTRING(title, 1, 249), \'-\', uid)',

This would use characters 1-249 from the title, add a dash and then the UID.