简体   繁体   中英

tx_news call a single news item withouth the hash

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?

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, eg:

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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