Dynamic back links for ext:news

If you did more than one TYPO3 project, you presumably know the following requirement: „We want to have a news list for press releases, a news list for R&D and a news list for HR. And all news shall be displayed on the same page. And of course, at the end of the single view, we need a link to go back to exactly the list the user came from.“

Some customers can be convinced with a hint to the browsers back button, but some not. I searched a lot to find a working solution (without JavaScript) and finally found a surprising simple one.

First you need to enrich your TypoScript with the following lines:

With that you make the formerly static backPid dynamic and stdWrap-able. Additionally you define a new setting called actbackPid to serve as a store for the news list’s page UID. So if there is a GP variable tx_news_pi1[actbackPid], backPid is set to that value. And actbackPid always contains the current pages UID.

The second thing you have to do, is to enrich the links from list view to single view with the new parameter actbackPid. The configuration parameter is the important part here.

Do so for all files similar to news/Resources/Private/Partials/List/Item.html in your own template extension.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.