Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-07-08 10:41:09

gesiwuj
Member
Registered: 2008-07-01
Posts: 20

A more "Wordpress" style of archiving

I was wondering how to make an archive system that works using the following structure; www.site.com/section/archive/pagenumber (although if it’s easier, archive/section) instead of /section/yyyy/mm/dd using page numbers (containing, say, 5 articles with pagination links at the bottom).

Is there a plugin for this type of functionality or is there another way to do this?

Offline

#2 2008-07-08 10:46:28

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,410

Re: A more "Wordpress" style of archiving

Maybe this?

Offline

#3 2008-07-08 10:48:31

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,729
Website

Re: A more "Wordpress" style of archiving

Under admin > preferences you can set a series of different permanent link schemes (see fig. 6 in the textbook article).

The plugin gbp_permanent_links allows you to set up custom schemes too.


TXP Builders – finely-crafted code, design and txp

Offline

#4 2008-07-08 11:17:09

gesiwuj
Member
Registered: 2008-07-01
Posts: 20

Re: A more "Wordpress" style of archiving

Thankyou for showing me the link for the plugin… but I’m not sure I communicated my intentions properly!

The main idea is using “numbered pages” for my archive (with a set number of articles on each page) instead of “dated pages” which would get the articles from that certain period of time (eg: on a monthly basis). I can achieve the latter using a plugin.

I’m not particularly sure how to start :)

I have several sections that are very similar structurally (they have the same page ie: template) and would have similar content.

I could also probably get an archive by just using the code;

<txp:article_custom limit=99999 form="my_form" section="<txp:section />" />

but this would show all the articles on one page… but I was hoping to allow it to be spread over multiple pages (with, say 5 articles on each) and then be able to add pagination links (like at the bottom of Google) which has; previous, next, first, last and individual page numbers…

Hope you can all help me :)
Thankyou very much!

Last edited by gesiwuj (2008-07-08 11:26:27)

Offline

#5 2008-07-08 12:26:23

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

Re: A more "Wordpress" style of archiving

What you need is more like

<txp:article limit="5" />

and

<txp:if_article_list>
<txp:older>previously</txp:older> | <txp:newer>newer</txp:newer>
<txp:else />
<txp:link_to_prev>previous</txp:link_to_prev> | <txp:link_to_next>next</txp:link_to_next>
</txp:if_article_list>

for the links to next or previous 5 articles if article list and next previous article when on individual page

Last edited by colak (2008-07-08 12:29:12)


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

Offline

#6 2008-07-08 13:00:14

gesiwuj
Member
Registered: 2008-07-01
Posts: 20

Re: A more "Wordpress" style of archiving

Thankyou very much, Colak. I will try this now and report my progress! In the mean time, I was messing around with gbp_permalinks and it’s very very useful! Thankyou for showing it to me.

Offline

#7 2008-07-08 14:42:42

gesiwuj
Member
Registered: 2008-07-01
Posts: 20

Re: A more "Wordpress" style of archiving

EDIT: Sorry for the double post.

Right… I have a section called “Archive” with a page associated with it called Archive. The (important bit of the) page looks like this;

<txp:article_custom form="list-item" section="section_name" limit="5" />

<a href="<txp:older />">&laquo; Older</a>

<a href="<txp:newer />">Newer &raquo;</a>

It displays the articles fine (even with the above 5 cutoff) but the Older and Newer buttons do not work. They are merely linking to mydomain/section_name

I have several sections and at the moment I’m just “hard-coding” the section’s name in. I hope to have it in dynamically so I need not have a section1-archive, section2-archive etc. The individual sections contain similar data structures.

Last edited by gesiwuj (2008-07-08 14:47:46)

Offline

#8 2008-07-08 15:11:50

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: A more "Wordpress" style of archiving

Older and newer don’t work with article_custom. If the sections you want to include in the archive are all set to be displayed on the front page, I guess you could create a workaround, for example using wet_if_page. Not tested:

<txp:wet_if_page><!-- page 1 = your front page -->
your code for the front page goes here
<txp:else /><!-- page 2 and up = your archive -->
<h2>Archive</h2>
<txp:article limit="5" />
<txp:older>older</txp:older> | <txp:newer>newer</txp:newer>
</txp:wet_if_page>

Offline

#9 2008-07-08 15:49:00

gesiwuj
Member
Registered: 2008-07-01
Posts: 20

Re: A more "Wordpress" style of archiving

Yes… I just started to realise that :(

And wouldn’t the wet_if plugin pull archives from every section of the site?

Offline

#10 2008-07-08 16:11:11

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: A more "Wordpress" style of archiving

Because you are actually using the front page, it would pull articles from all sections that are set to be displayed on the front page. If that’s not compatible with your site structure, then this workaround won’t help you I’m afraid.

Offline

#11 2008-07-08 16:55:34

gesiwuj
Member
Registered: 2008-07-01
Posts: 20

Re: A more "Wordpress" style of archiving

I tried adding it to my section’s “page”… but it didn’t work too well. Basically it had a conditional that says “if it’s individual article, load appropriate form” and “or else, load the ‘landing page’”… I was trying to incorporate another conditional that sees if it “is_article_list” which I think could work, but there are several problems I’m facing; a) how would the “article list” be accessed, URL-wise? b) how would I do a three-way conditional with TXP tags? c) I tried but it just looped my landing page 7 times (the number of articles I have) and the archives section 7 times… although I think this was actually unrelated and was an unassociated flaw on my part.

Does anyone have any ideas for this… or indeed any other method of doing this kind of archive. It’s proving quite a headache because I have a weird Information Architecture. I’ll try and explain the site’s current structure below:

THE SITE: The site hosts multiple podcasts. Each podcast has its own section and should have articles (an individual episode) and a landing page (containing details etc.) and individual archives. Each podcast is within its own section and they all share the same page (template). There are also static pages (eg: an About Us page):

/podcast1/ leads one to podcast 1’s landing page. This works currently.
/podcast1/episode/01 leads to the article (ie: episode) entitled “01”. The “episode” is added using gbp_permalinks
/podcast1/archive should lead to podcast 1’s archive (page 1 of it).

Then I’d have the same for the other podcasts. I did manage to get a /archive section going but that didn’t work because older/newer links didn’t work as I was using article_custom and couldn’t access another section :(

Last edited by gesiwuj (2008-07-08 16:58:20)

Offline

#12 2008-07-08 21:50:11

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: A more "Wordpress" style of archiving

gesiwuj wrote:

/podcast1/ leads one to podcast 1’s landing page. This works currently.
/podcast1/episode/01 leads to the article (ie: episode) entitled “01”. The “episode” is added using gbp_permalinks
/podcast1/archive should lead to podcast 1’s archive (page 1 of it).

Then I’d have the same for the other podcasts. I did manage to get a /archive section going but that didn’t work because older/newer links didn’t work as I was using article_custom and couldn’t access another section :(

Ah, I think I’m getting it now. You won’t get pagination to work when using a separate ‘archive’ section, because you’d need article_custom for that. But if you only want archives per section, and not one big archive for all sections, I think it must be possible to find a way. The example I gave is not useful at all for this situation.
Just to make sure I understand you correctly:

  • podcast1 is a section
  • your section landing page /podcast1/ has some static content, a sticky article maybe?
  • episode is… ? just a text string? or a category?

You’d need to find a way to add archive to the URL – without leaving the article list mode – and I’m thinking about a category here, or are you already using both categories for your articles?

Offline

Board footer

Powered by FluxBB