Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
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
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
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
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
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
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:
- smd_if and urlvars to filter your list inside the article call… or even
- 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
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
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
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
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
Pages: 1