[TYPO3-english] tt_news single view prev/next links

Oliver Salzburg kinggencha at googlemail.com
Fri Nov 11 15:37:45 CET 2011


On 2011-11-11 12:35, Oliver Salzburg wrote:
> Hi,
>
> I just noticed a problem on one of our pages in the SINGLE view of a
> tt_news instance.
> The previous/next article links at the top of the SINGLE view are always
> rendered in the default language of the page and they point to
> the wrong articles (not the previous and/or next one).
> The "next article" link usually points to the right article, but the
> "previous article" link usually points to the current article.
>
> What's going on here?

Wow, tt_news is really a piece of "amazing work".

I'm pretty sure I found the cause for both issues. First of all,
tt_news will construct a somewhat long WHERE clause to build a list
of news entries that were created before and after the one that is
currently being viewed. It does that based on the field selected for
sorting news entries. In my case (the default) nextPrevRecSortingField
is "datetime".

The problem with that is, it creates a list of all news entries in
their default language and then compares their datetime value to that of
the currently being viewed entry (which is not the default language).
So if you put translations of news entries on your site and you don't
do it in the correct order, the whole mechanism fails.

And why are my links not in the correct language?
Well, I guess this has something to do with it:

function getPrevNextRec($getPrev, $selectConf, $fN, $fV) {

	// ...
	
	/**
	 * TODO: 05.05.2009
	 * lang overlay
	 */

	return $rows[0];
}

Regards,

Oliver


More information about the TYPO3-english mailing list