Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-05-05 05:30:58

Sterculius
New Member
Registered: 2009-04-28
Posts: 4

Next/Prev links: how to?

To preface my question, I will say that I’ve been setting up a site using textpattern to populate more in a gallery setup than a blog or news site. Thus, something simple like next and previous article links are throwing me for a whirl.

I have a Section named “Archive_PG” that uses a page called “music_archive_pg” which is a page displaying 1 article from my article category “Archive”. I am wanting this page to display 1 article (which it does) with Next and Prev links. I currently have 2 articles in this category.

However, I can’t seem to find a place (either in the Page or in the Form or anywhere) that will actually spit me out a Next/Prev title or link.

I feel like I’m hitting a brick wall and can’t seem to figure out how this works, and the documentation isn’t benefiting me in this capacity. If someone would be so kind as to humor me, that’d be awesome. Thanks!

Offline

#2 2009-05-05 07:31:50

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

Re: Next/Prev links: how to?

Sterculius wrote:

a page displaying 1 article from my article category “Archive”. I am wanting this page to display 1 article (which it does) with Next and Prev links

As far as I am aware, the next/prev only work in an individual article context so once you have “left” the category listing (where “older/newer” tags page through the results), then you have lost the category context.

You may have some luck with my new plugin smd_horizon which should allow you to navigate articles within the current category. Unless someone can offer alternative advice on a native way to do it, feel free to give the plugin a whirl and scribble anything you find on the plugin’s thread. Hope that helps.

EDIT: another bonus of the plugin is that your next/prev link could actually be the thumbnail of the corresponding article image, so for a gallery site this might suit you quite well.

Last edited by Bloke (2009-05-05 07:33:14)


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

Online

#3 2009-05-06 03:14:02

Sterculius
New Member
Registered: 2009-04-28
Posts: 4

Re: Next/Prev links: how to?

Thanks for responding. I’m still at a loss unfortunately.

I’m abandoning the separate page for now and messing around with the articles themselves.

Say I’m on an article page “index.php?id=18” (or whatever). How do I get it to only do prev/next links for a specific category? It seems like this should happen naturally, but it wants to lead me to any article. When I put the next and prev links into the form for the article, it doesn’t discriminate categories no matter what I seem to do.

All I want to do is make my “archive” category viewable one at a time without my entire library of articles. Any examples or pointers would be helpful. Thanks.

EDIT: I think I may be headed in the right direction now after tinkering. Ignore me for now..heh.

Last edited by Sterculius (2009-05-06 03:19:27)

Offline

#4 2009-05-06 05:54:07

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,091
Website GitHub Mastodon Twitter

Re: Next/Prev links: how to?

All I want to do is make my “archive” category viewable one at a time without my entire library of articles.

How are you calling your articles? If you use article_custom the next/previous would not work but if you use the article tag all will work just fine especially if you use smd_horizon as Steff suggested.

sample code <txp:article limit="1"/>.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#5 2009-05-06 13:16:46

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

Re: Next/Prev links: how to?

Sterculius wrote:

How do I get it to only do prev/next links for a specific category?

As I alluded to earlier, unfortunately I don’t think you can out of the box. Categories are simply ways of grouping content (see the Semantic model for more on this topic) and next/Prev will only — at least as far as I know — iterate among articles in a Section. Since any Category can be applied to more than one Section, and articles belong to one and only one Section (they are merely “tagged” with categories for want of a better phrase) the next/prev don’t work as you expect them to.

If you only want articles in your archive ‘category’ to be viewed one by one and next/prev through them and you don’t want to try smd_horizon which lifts the restriction, consider changing your thinking: assign articles to their own section then use the <txp:article /> tag as colak suggested in your template. Your next/prev will then work naturally to step through the articles.

It might be worth having a browse round TxpTips and look at, for example, the archives part. You can treat articles in any Section as both “what’s latest” and “show ‘n’ articles from this section” by using the <txp:article /> tag.


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

Online

#6 2009-05-07 06:00:32

Sterculius
New Member
Registered: 2009-04-28
Posts: 4

Re: Next/Prev links: how to?

Yeah, I ended up just using the article pages themselves. That route just seemed foreign to me since I’d been making custom pages for everything else. Thanks for your help!

Offline

Board footer

Powered by FluxBB