Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2012-09-15 13:08:51

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,241
GitHub

prev & next navigation weirdness

Hi. I’ve been battling with this for a few hours and I’m stumped. I have a feeling it’s something derpy I’m doing wrong, but I need to step away before I punch a fist through my screen. Yes, it’s been that kind of morning :)

OK, this relates to my blog, here — it is work safe, no swearing. At the present time, these are the twelve most recent posts (descending order, chronological – output by article_custom in the footer and article in the main page, nothing fancy):

  1. Cryptic much
  2. Delivering fuel and design changes
  3. Old school
  4. Friday, so far
  5. Millionaires row, Cornwall
  6. It’s Thursday, yo
  7. Today is Wednesday and it’s going to be a good one
  8. Hello, unknown person from near Birmingham on BT Broadband
  9. Getting my houses in order
  10. So much that I can’t say + soup
  11. Suggestions, please
  12. Yesterday was bumpy, today is OK

My understanding is that a given article with the following code in the article form should display a hyperlink to the previous and next articles where they exist:

<txp:if_individual_article>
<div class="pagination pagination-centered">
	<ul>
		<li><txp:link_to_prev>&larr;&nbsp;<txp:prev_title /></txp:link_to_prev></li>
		<li><txp:link_to_next><txp:next_title />&nbsp;&rarr;</txp:link_to_next></li>
	</ul>
</div><!-- pagination pagination-centered -->
</txp:if_individual_article>

So, article #2 above should have a link to #3 and #1, article #3 should have a link to #4 and #2, and so forth. Sadly, this isn’t the case. Here’s the deal:

  1. Links to itself
  2. Links to itself and #1
  3. Links to itself and #2
  4. Links to #3 and #2
  5. Links to itself and #4
  6. Links to #5 and #4
  7. Links to #7 and #6
  8. Links to itself and #6
  9. Links to itself and #8
  10. Links to itself and #9
  11. Links to itself and #11
  12. Links to #11 and #10

Huh. What the eff?

Debugging mode is on. I’ve styled prev links with a &larr; and next links with a &rarr; if that helps. I am completely out of ideas on this one.

Thank you in advance for any pointers.

Edit: clarified use of article_custom and article.

Last edited by gaekwad (2012-09-18 15:49:42)

Offline

#2 2012-09-15 13:47:41

etc
Developer
Registered: 2010-11-11
Posts: 5,160
Website GitHub

Re: prev & next navigation weirdness

Why are you using <txp:article_custom />? <txp:link_to_prev> and <txp:link_to_next> are retrieved from <txp:article />, so the result with <txp:article_custom /> is unpredictable.

Offline

#3 2012-09-15 13:59:04

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,241
GitHub

Re: prev & next navigation weirdness

etc wrote:

Why are you using <txp:article_custom />? <txp:link_to_prev> and <txp:link_to_next> are retrieved from <txp:article />, so the result with <txp:article_custom /> is unpredictable.

Hi Oleg.
I am using article_custom in this context inside the footer (‘Recent posts’) links:

<txp:article_custom form="article_list_recent_posts" limit="12" section="blog" />

…because article doesn’t allow section as a parameter. The default sort order for article is Posted desc, and the default sort order for article_custom is also Posted desc, so there should be no difference, right?

Last edited by gaekwad (2012-09-15 14:09:17)

Offline

#4 2012-09-15 14:12:40

etc
Developer
Registered: 2010-11-11
Posts: 5,160
Website GitHub

Re: prev & next navigation weirdness

gaekwad wrote:

The default sort order for article is Posted desc, and the default sort order for article_custom is also Posted desc, so there should be no difference, right?

Right, unless you use something like <txp:article limit="0" />, but it’s still weird. Anyway, <txp:article /> is context-sensitive, so in your blog section you don’t need section attribute?

Offline

#5 2012-09-15 14:16:12

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,241
GitHub

Re: prev & next navigation weirdness

etc wrote:

Anyway, <txp:article /> is context-sensitive, so in your blog section you don’t need section attribute?

Hi Oleg.
Thank you for your time with this. I’m using this to output the articles in /blog:

<txp:article limit="15" />

The article_custom is only used in the site footer, and that’s global. The article output order above is identical to the article_custom output in the footer.

Offline

#6 2012-09-15 14:48:08

etc
Developer
Registered: 2010-11-11
Posts: 5,160
Website GitHub

Re: prev & next navigation weirdness

Very weird, indeed. Pete, is there another <txp:article /> on the page, or some plugins?

Edit: just discovered I have the same issue on localhost site under txp 4.5.0, but not and also under 4.5.1. But not on other sites.

Last edited by etc (2012-09-15 15:15:58)

Offline

#7 2012-09-15 15:18:01

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,241
GitHub

Re: prev & next navigation weirdness

etc wrote:

just discovered I have the same issue on localhost site under txp 4.5.0, but not and also under 4.5.1. But not on other sites.

Hi Oleg.
Well, I’m glad it’s not just me being stupid — thank you for testing it. I will build a localhost 4.5.1 and try to reproduce the steps to file a bug report (if appropriate).

Edit: I wonder, Oleg, are your localhost sites and other sites on the same timezone settings? I ask because I’ve just replicated my site to a localhost (petecooper.org.dev – screenshots to follow) and it’s behaving as expected (that is, prev/next article nav works). I will continue to probe and see what I can find. The only difference I know about on localhost is timezone — my remote sites are PDT, localhost is GMT, both have DST enabled.

Last edited by gaekwad (2012-09-15 15:26:02)

Offline

#8 2012-09-15 15:36:50

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,241
GitHub

Re: prev & next navigation weirdness

Interesting findings coming up…
Two screenshots — localhost and remote server of the same page/article. Identical database — exported from the remote server and replaced the localhost version with the fresh export. Timezones are the same in the Textpattern admin, though system times are GMT and PDT for localhost and remote server respectively.

The localhost behaves as expected, the remote doesn’t.

Last edited by gaekwad (2012-09-15 15:37:12)

Offline

#9 2012-09-15 15:43:54

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,241
GitHub

Re: prev & next navigation weirdness

Bumping remote site to 4.5.1 to see if that helps things.

Edit: no, same thing.

Last edited by gaekwad (2012-09-15 16:06:04)

Offline

#10 2012-09-15 15:57:36

etc
Developer
Registered: 2010-11-11
Posts: 5,160
Website GitHub

Re: prev & next navigation weirdness

My local and remote have different os, php, mysql and apache versions, different settings too, so I do not know whom to suspect first. I have tried enabling/disabling DST, without any result.

Edit: another site on localhost runs fine under 4.4.1

Last edited by etc (2012-09-15 16:12:21)

Offline

#11 2012-09-15 16:23:28

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,241
GitHub

Re: prev & next navigation weirdness

etc wrote:

another site on localhost runs fine under 4.4.1

Thanks, Oleg. I will do some localhost clean installs (4.4.1, 4.5.0, 4.5.1) and try to diagnose the problem.

Offline

#12 2012-09-15 18:09:45

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,330
Website Mastodon

Re: prev & next navigation weirdness

Is there a chance that the web server and the mysql server are in different timezones?

Offline

Board footer

Powered by FluxBB