Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-08-19 12:41:31

Jaro
Member
From: S/F
Registered: 2004-11-18
Posts: 89

Previous / Next Article functionality doesn't work

In case that articles have same publish timestamp the previous / next functionality doesn’t work as expected. Clicking on the previous link takes you to the article which has the next earlier timestamp.

I guess TXP looks for the article publish timestamp to determine the order of the articles. Is it possible to improve this logic? It could go like this:

IF previous article has same timestamp than the current one THEN look at the article id and display the article with the next lower id.

Does that make sense?

I came across this issue when importing a lot of articles via plugin. They all have the same publish date. There is a way around it (setting different publish timestamp) but I thought I would mention it here anyway. Maybe it’s something that could be improved?

Offline

#2 2011-08-19 13:07:52

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Previous / Next Article functionality doesn't work

Robert’s latest commits, r3585 addresses similar issue; neighbor sorting in general.

Adding ID column to the order by clause should sort it (get it, sort it ha – ha – ha, yeah not funny) when sorting by publishing date. Basing on r3585.

--- /texptattern/publish.php	2011-08-19 15:59:26.000000000 +0300
+++ /textpattern/publish.patch.php	2011-08-19 16:01:34.000000000 +0300
@@ -1032,6 +1032,8 @@
 			($s!='' && $s!='default') ? "and Section = '".doSlash($s)."'" : filterFrontPage(),
 			'and Status=4 and Posted < now()'.$expired.' order by '.$col,
 			($type=='<') ? 'desc' : 'asc',
+			', ID',
+			($type=='<') ? 'desc' : 'asc',
 			'limit 1'
 		);

Offline

Board footer

Powered by FluxBB