Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 Yesterday 16:12:09

imazer
Member
Registered: 2024-06-19
Posts: 20

More PHP Fun?

Well folks, another odd problem cropped up.

When I call up an article, the previous and next links beneath the comment section (closed or open) populate with the wrong titles. I can see the correct titles embedded in the status bar of my browser showing the actual links and similarly, in the source offered by browser web tools.

E.g.

   <a title="Grandma" rel="prev" href="https://imazerweb.com/middle/26/grandma">A Touch of Wilderness</a>
   <a title="Time" rel="next" href="https://imazerweb.com/middle/28/time">For Xanthe</a>

Any ideas about the mismatch?

Example article page used:

https://imazerweb.com/middle/27/when-to-keep-it-in-your-pants

Thanks!

Offline

#2 Yesterday 16:34:16

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,256
Website Mastodon

Re: More PHP Fun?

Jakob once provided this code, which works for me:

<txp:if_individual_article><p>
<txp:link_to_prev>&#171; <txp:title /></txp:link_to_prev> |
<txp:link_to_next><txp:title /> &#187;</txp:link_to_next>
</p>
</txp:if_individual_article>

the links of prev and next are output as titles.
hope this helps.


…. texted postive

Offline

#3 Yesterday 18:38:07

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

Re: More PHP Fun?

I expect your <txp:link_to_*> container tags use <txp:prev_title /> and <txp:next_title /> tags. That’s legacy usage.

Since link_to_* tags now automatically shift context to point at the next/previous article, as bici says, you need to use the <txp:title /> tag instead to get “this” article’s data. Otherwise you’re effectively telling Textpattern to fetch the next-next or prev-prev article info.


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

#4 Yesterday 22:02:11

imazer
Member
Registered: 2024-06-19
Posts: 20

Re: More PHP Fun?

bici and Bloke,

I tried the code and it worked perfectly. So thank you for the code and the explanation!

Offline

Board footer

Powered by FluxBB