Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2016-06-02 22:12:31

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

Re: How to troubleshoot missing link_to_next and link_to_prev?

I diffed the outputs of the two dmp() functions, and the key-value pairs for next_* and prev_* are the only difference.

Putting the same dmp() function after the article tag gives me the same result as putting it immediately before: next_* and prev_* keys show up in the output, but all the prev_ values are empty.

Offline

#14 2016-06-02 22:21:25

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,271
Website GitHub

Re: How to troubleshoot missing link_to_next and link_to_prev?

Thanks for the Form code. I just tried it on a 4.6.0-beta site and it appears to work, so I wonder if this is all part of the next/prev tweaks that etc (among others) fixed? In which case, it could be a 4.5.7-only bug.

Although I don’t have an empty 4.5.7 installation to hand to test it, I take your word for it that it’s broken. And unfortunately, the amount of fixes that went into next/prev are sprayed across about 20+ commits spanning more than a year. So it’s not a case of recommending that you temporarily hack a 4.5.7 file to resemble a particular 4.6.0 state that fixes it.

Not sure what to suggest, sorry. Maybe etc has some pearls of wisdom to add.


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

Txp Builders – finely-crafted code, design and Txp

Offline

#15 2016-06-02 22:26:38

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

Re: How to troubleshoot missing link_to_next and link_to_prev?

Thank you, Stef!

Did you see this post from earlier?

johnstephens wrote #299435:

…I thought all I would need to do is set “Publish expired articles?” to yes, and then add some articles in the articles section, and make all of them expired except for the newest one.

That did not reproduce the problem, though. Textpattern was still able to detect adjacent articles using the link_to_next and link_to_prev tags already present in the archive template. …

I don’t think it’s a bug in 4.5.7, at least it’s not a bug that I could reproduce in a few steps with a fresh install.

Unfortunately, I don’t know where to look next. Plugins? Something else? What could be clobbering my next_ and prev_ values from $thisarticle?

Offline

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

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,271
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.

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: 11,271
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.

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: 999
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: 11,271
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.

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: 999
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: 999
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: 999
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: 11,271
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.

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: 999
Website

Re: How to troubleshoot missing link_to_next and link_to_prev?

Offline

Board footer

Powered by FluxBB