Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
link_to_next & link_to_prev help & explanation
So this will be a novice question.
Page in question – http://clientarea.shiftideas.com/rotary/website/projects/
If you click the next link (link_to_next), it displays the next article in the section. But on that page it does not show a link back to the previous article. It does show a link to the previous article (link_to_prev) on the next page. Click around to see what I’m talking about. Why is this happening?
The code on my page looks like this
<code><div class=“articleNav”>
<span style=“float:right”>Next: <txp:link_to_next><txp:next_title /></txp:link_to_next></span>
Previous: <txp:link_to_prev><txp:prev_title /></txp:link_to_prev>
</div>
<txp:article limit=“1” />
</code>
Also, the next link shows links to the next oldest article in the section. Is this correct as I was under the impression it would show a link to the next newest article.
I’ve read the wiki help page but am still a bit lost.
Offline
#2 2006-04-28 02:46:31
- zem
- Developer Emeritus
- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: link_to_next & link_to_prev help & explanation
next/previous refer to the time and date order of articles. “previous” doesn’t work like the browser back button. From your description it sounds like that’s what you’re expecting.
Alex
Offline
Re: link_to_next & link_to_prev help & explanation
Hi LeeUmm,
this is from the txp:article in the TextBook:
pgonly=“integer”
Do the article count, but do no display anything. Used when you want to show a search result count, or article navigation tags before the list of articles. Available values: 1 or 0.
Note: pgonly’ tells the tag to do the article/pagination count but not display anything. I added it so you can use pagination tags above the article list, but search result count should work also. Just make sure that, other than pgonly, both article tags are identical.”
So… try using the pgonly attribute in this way:
<code><div class=“articleNav”>
<txp:article limit=“1” pgonly=“1” />
<span style=“float:right”>Next: <txp:link_to_next><txp:next_title /></txp:link_to_next></span>
Previous: <txp:link_to_prev><txp:prev_title /></txp:link_to_prev>
</div>
<txp:article limit=“1” />
</code>
Offline
Re: link_to_next & link_to_prev help & explanation
Thanks for input so far.
The pgonly ends up displaying articles twice. I used it set at “1” and set at “0” and both times using the above code the articles displayed twice. I also tried moving the next/previous link below the the article tag and had the same problem.
I’ll try to explain the problem a bit better as I don’t except the previous link to work like the back button.
On the page in question, I have a group of articles posted in the section listed by default which is date.
When you view the section page – http://clientarea.shiftideas.com/rotary/website/projects/ you see the latest/newest article. I have the limit set to 1 per page so you see the next link but not a previous link. That’s fine with me but when you click on the next link – http://clientarea.shiftideas.com/rotary/website/projects/organic-equine-fertilizer you get the next <b>oldest</b> article and no link to the previous article.
As I said, when you view the section – http://clientarea.shiftideas.com/rotary/website/projects/ you are shown the latest article. Take a look at the next/prev links and then view next/prev links with the same article’s perma link – http://clientarea.shiftideas.com/rotary/website/projects/rotary-cattel-senior-centre
Offline
#5 2006-04-28 08:09:54
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: link_to_next & link_to_prev help & explanation
pgonly must be an integer value, not a string (i.e: don’t put quotes around it):
<txp:article limit="1" pgonly=1 />
Offline
#6 2006-05-23 00:58:53
- ciorsida
- New Member
- Registered: 2006-02-11
- Posts: 2
Re: link_to_next & link_to_prev help & explanation
I’m having this same problem.
txp:article section=“singles” form=“singles” limit=“1” sortby=“posed” sortdir=“desc” pgonly=“1”
This returns a blank first article and then a populated second article that includes a Next link but no Previous link. Then, at the end of the stack, the first article is repeated again, but populated with content. Go figure.
With no pgonly=“1” tag the only difference is that the first post appears populated from the start, still reappears at the end, second article still lacks a Previous link.
I’m totally confused by this.
Last edited by ciorsida (2006-05-23 01:00:54)
Offline
#7 2006-05-23 01:18:46
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: link_to_next & link_to_prev help & explanation
pgonly must be an integer value, not a string (i.e: don’t put quotes around it):
<txp:article limit="1" pgonly=1 />
Offline
#8 2006-05-23 12:55:24
- ciorsida
- New Member
- Registered: 2006-02-11
- Posts: 2
Re: link_to_next & link_to_prev help & explanation
I tried this change, and it reverted back to the same results that pgonly=“1” produced. The first article in the stack shows up unpopulated with a next link. The second shows up populated, but only with a next link, no previous link. The first article shows up again at the bottom of the stack as well.
Offline
#9 2006-05-23 17:25:41
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: link_to_next & link_to_prev help & explanation
One thing I just noticed is that above you have sortby="posed"
, which would stop anything from showing up, if that’s the actual string you use in your page.
<txp:article section="singles" pgonly=1 limit="1" sortby="Posted" sortdir="desc" form="singles" />
The second shows up populated, but only with a next link, no previous link. The first article shows up again at the bottom of the stack as well.
That contradicts what you’ve posted ("limit=1"
), what are the other tags are you using?
Offline