0

I have setup the TYPO3 news extension (not tt_news) to show a date menu with archived news items. From the archive menu, you can go to the list-view with all news for a given month. From the list-view, you can go to the details-view, to actually view the news item. In the detail view, I have configured the list-view as PageId to return to.

I think this is a standard setup and has nothing special.

The link from the date-menu to the list-view contains the GET parameter "overwriteDemand", which adds the month and year to the demand of the list view, so only the news articles for the given month/year are shown. Actually this GET parameter is not kept, when linking to the detail-view (with the n:link viewHelper) and therefore also not given back to the list-view, when I go back to the list-view from the detail view. The list-view therefore shows all news records after I come back to the list view from a detail-view.

Adding a javascript.back() button is no solution for me, since I want to use real links.

Am I missing something or is this a missing feature?

derhansen
  • 5,585
  • 1
  • 19
  • 29

3 Answers3

1

There are two ways to handle this.

the first option is, to edit the templates and add the parameters to the links using the arguments parameter of f:link.page (or something similar).

Second option is, create a new extension-template in the tree of the single page and add some typoscript, which keeps the parameters in the rendered link. The config name ist called linkVars and is descriped here: http://docs.typo3.org/typo3cms/TyposcriptReference/Setup/Config/Index.html#linkvars

Merec
  • 2,751
  • 1
  • 14
  • 21
  • tx_news uses an own ViewHelper n:link to generate Links to other actions. This viewHelper takes care of all settings configured to the plugin, so it is no option to just change to f:link.page, since you have to add all attributes youself. This seems not to be very future stable and 'arguments' is not a parameter for n:link Your first option would suit for the detail view, if you use the addQueryString option. – derhansen Sep 24 '14 at 13:44
0

tx_news uses <f:link.page in his templates. I just checked on github tx_news to see if it changed, but it still looks the same.

This is how tx_news generates the backlink:

<f:if condition="{settings.backPid}">
    <!-- Link Back -->
    <div class="news-backlink-wrap">
        <f:link.page pageUid="{settings.backPid}">
            <f:translate key="back-link" />
        </f:link.page>
    </div>
</f:if>

So it looks like the overwriteDemands are not kept. I think it would be a really good sugestion to the tx_news Dev-Team to keep the overwriteDemands in the backlink.

You have the {overwriteDemand} as an object in your template, so for now you can use something like this:

<f:link.action pageUid="{settings.backPid}" arguments="{overwriteDemand:{year: year, month: month}}">
nbar
  • 6,028
  • 2
  • 24
  • 65
0

First, you have to write a bit of typoscript to store the pagination currentPage :

lib.currentPage = TEXT
lib.currentPage {
   value = 1
   override.data = GP:tx_news_pi1|currentPage
}

In the paginated news list page, give the currentPage value to all links pointing to detail page :

<n:link newsItem="{newsItem}" settings="{settings}" configuration="{additionalParams:'&tx_news_pi1[currentPage]={f:cObject(typoscriptObjectPath: \'lib.currentPage\')}'}">
Read more
</n:link>

Then in the detail page, finishing by building back link to previous paginated list page :

<f:variable name="currentPage"><f:cObject typoscriptObjectPath="lib.currentPage"/></f:variable>
<f:link.page class="btn btn-xs" pageUid="{settings.backPid}" additionalParams="{'tx_news_pi1[currentPage]': currentPage}">
  Back
</f:link.page>

;-)