Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#16 2016-06-02 22:28:23

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,499
Website GitHub

Re: How to troubleshoot missing link_to_next and link_to_prev?

johnstephens wrote #299442:

Did you see this post from earlier?

Missed that, oops.

I don’t know where to look next. Plugins?

Possibly. Don’t suppose you have smd_horizon installed? That does crazy things with next/prev.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#17 2016-06-02 22:30:52

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,499
Website GitHub

Re: How to troubleshoot missing link_to_next and link_to_prev?

You could probably just add wet_plugout to your arsenal, use it to turn off all plugins in your site and see if the problem goes away. If it does, it’ll just be a case of flicking them back on one by one until the problem shows up… and hope it’s not one of mine :-)

If you have tonnes of plugins, this is a bit of a pain. But at least it narrows the field by absolving core of any wrongdoing.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#18 2016-06-02 22:46:41

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 1,000
Website

Re: How to troubleshoot missing link_to_next and link_to_prev?

With wet_plugout I disabled all plugins. Then I re-enabled rah_output_section_form (v0.3) right away, because the txp:article and pagination tags I’m testing exist in a form that is summoned by the rah_output_section_form tag.

With only that plugin enabled, I was getting the same behavior in the section with expired articles.

I see that Gocom no longer recommends using the plugin, and I will test again after switching to his txp:yield-powered factory method. But it seems unlikely that Ye Aulde rah_output_section_form would mess clobber my prev_ and next_ values, right?

Offline

#19 2016-06-02 22:57:08

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,499
Website GitHub

Re: How to troubleshoot missing link_to_next and link_to_prev?

johnstephens wrote #299445:

With only that plugin enabled, I was getting the same behavior in the section with expired articles… it seems unlikely that Ye Aulde rah_output_section_form would mess clobber my prev_ and next_ values, right?

It does indeed seem odd. Unless rah_output_section_form does some global variable tomfoolery, it must be something else other than a plugin. But what…? Stumped.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#20 2016-06-02 23:07:58

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 1,000
Website

Re: How to troubleshoot missing link_to_next and link_to_prev?

I don’t think it was the plugin.

I created a simple page template for the section:

<txp:article><txp:permlink><txp:title/></txp:permlink></txp:article>
<txp:link_to_prev/>
<txp:link_to_next/>

With all plugins disabled, it worked fine. Then, enabling the plugins one-by-one, it kept working fine—even with all the plugins active.

It must be something I’m doing in my templates then, right? Time to do a tag trace?

Offline

#21 2016-06-03 18:08:37

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 1,000
Website

Re: How to troubleshoot missing link_to_next and link_to_prev?

This is fixed.

It was a very simple mistake, an obvious mistake in hindsight.

When I posted the adjacent article nav form here, I actually combined relevant content from two form templates: The variables and if_variable checks were part of a form that is loaded early on in parsing the page, and the stuff in the <nav> element were part of a form that is rendered much later, in the default article form summoned by the txp:article tag, in the body of the page.

The solution was simply to add one tag above the variables (which are already nested in an if_individual_article conditional):

<txp:article pgonly="1"/>

<txp:variable name="prev_url"><txp:link_to_prev/></txp:variable>

<txp:variable name="next_url"><txp:link_to_next/></txp:variable>

This problem and solution completely eluded me because it worked without that txp:article tag in every section except the one that included expired articles that I wanted to include in the prev/next navigation.

Case closed!

By the way, the information I got from the dmp() function was a red herring, more-or-less:

Putting it first thing on the page showed no output for the next_* or prev_* keys, but it turns out that was completely fine. Putting it after the form where I used the link_to_prev and link_to_next tags without a preceeding article tag showed that it was giving different results, but interpreting those results wasn’t helpful.

Last edited by johnstephens (2016-06-03 18:11:52)

Offline

#22 2016-06-03 18:10:54

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 1,000
Website

Re: How to troubleshoot missing link_to_next and link_to_prev?

So, you say these tags were updated over several rounds of revisions for Txp 4.6. Does my current implementation seem valid for a 4.6 site? Or do you think this will require careful re-examination when it’s time to upgrade?

Offline

#23 2016-06-03 18:26:46

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,499
Website GitHub

Re: How to troubleshoot missing link_to_next and link_to_prev?

johnstephens wrote #299494:

Does my current implementation seem valid for a 4.6 site?

Yes. Glad you got it sorted, btw. The changes in 4.6 address bugs in the way that next/prev works under corner case conditions, such as if the articles have identical timestamps (which happens when you clone, for example) or with non-time-based sort parameters. Under 4.5.7, weirdness ensued where articles were skipped or appeared in strange orders.

Your approach should be fine as I doubt it’s affected by the changes, but it might be worth a quick test on a non-production site if we could tempt you with the beta…


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#24 2016-06-03 18:32:49

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 1,000
Website

Re: How to troubleshoot missing link_to_next and link_to_prev?

Offline

#25 2016-08-01 19:02:37

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 1,000
Website

Re: How to troubleshoot missing link_to_next and link_to_prev?

This appears to work without a hitch in 4.6 beta 2!

Offline

Board footer

Powered by FluxBB