Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-03-14 12:58:46

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Archive by month

I’m having a brain freeze today, I’m sure this is quite simple…

How can I create a sidebar showing a clickable list of any months in which articles have been posted (just the months, not a list of articles themselves)? And when a month is clicked on it shows an article list page of just the articles within just that particular month?

Cheers,
Phil

Offline

#2 2011-03-14 13:36:57

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,001
Website GitHub

Re: Archive by month

I was just about to write a suggestion, then thought I’d seen something similar before – take a look at this thread. You just need to combine it a bit.

The principle is to do an article list but only output the posted month using txp:if_different. That will produce a list of months where in which articles were published. txp:article is context-sensitive to month, so you just need to create the appropriate link format and txp:article will do a normal article list by month…

Last edited by jakob (2011-03-14 13:37:14)


TXP Builders – finely-crafted code, design and txp

Online

#3 2011-03-14 13:38:46

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,315

Re: Archive by month

Sorry I can’t be of more help at the moment: just a link to a post with a similar issue I once bookmarked, but maybe enough to initiate a defrosting process.

Edit: jakob was faster, and more on the spot what? Closer ;)

Last edited by uli (2011-03-14 13:42:40)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#4 2011-03-14 13:56:12

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: Archive by month

Hi again,
Thanks for the advice, I’d already used that exact method to create the month list, I was just unsure if that was the best approach or how it can link to an article list within a specific timeframe. I’ll investigate txp:article options then.
Thanks again,
Phil

Offline

#5 2011-03-14 14:21:32

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: Archive by month

Hmmm, I can’t seem to find a native way to display just a month’s worth of articles, I think I’ll look at upm_date_archive instead (unless someone knows of a way).

Offline

#6 2011-03-14 15:50:44

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: Archive by month

Actually, I should have read uli’s link first, that forum post shows how to display an article list just for a single month, so no need to use upm_date_archive. It’s via a link like this…

<a href="<txp:site_url /><txp:section />?month=<txp:posted format="%Y-%m" />/"><txp:posted format="%B" /></a>

Offline

#7 2011-03-14 15:55:49

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

Re: Archive by month

yeah, limiting an explicit date range really should be a capability of article_custom and I think is a feature of the venerable chh_article_custom.

If using an alternate article_custom tag makes you throw up a little in your mouth, you could use:

  1. smd_if and urlvars to filter your list inside the article call… or even
  2. smd_query to supply more specific seach criteria on your article call.

But those solutions would require you submitting to the wicked will of “the bloke”

Edit: Alright, Alright… use a pencil, instead of spending millions to engineer a pen that writes in space… you hear me Mr. Occam?

Last edited by mrdale (2011-03-14 15:58:19)

Offline

#8 2011-03-14 17:35:12

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Archive by month

mrdale wrote:

yeah, limiting an explicit date range really should be a capability of article_custom

Which in fact is one of the original features of article_custom. From the Tag Reference:

month="yyyy" / "yyyy-mm" / "yyyy-mm-dd"
Restrict to articles posted within the specified year/month/day.
Default: unset.

Context aware article does same with URL modifiers.

Offline

#9 2011-03-14 18:00:06

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,001
Website GitHub

Re: Archive by month

Context aware article does same with URL modifiers.

… yes, but it’s not actually mentioned anywhere in the txp:article docs. I remember now that Jeff examined it in more detail here and here.

Last edited by jakob (2011-03-14 18:00:28)


TXP Builders – finely-crafted code, design and txp

Online

#10 2011-03-14 18:23:15

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

Re: Archive by month

Gocom wrote:

Which in fact is one of the original features of article_custom. From the Tag Reference:

Yeah, I suppose what I’m referring to is a custom date range which has a start and and end value

Should have been clearer, but you’re (obviously) right.

Offline

#11 2011-03-14 22:06:44

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: Archive by month

They are a little old but you could try looking at Simple Archives and Simple Archives Part 2. Does exactly what it says on the tin and doesn’t use any plugins. I do wish people would think before they jump on a plugin. :(


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

Board footer

Powered by FluxBB