Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-02-18 10:57:54

Algaris
Member
From: England
Registered: 2006-01-27
Posts: 580

Limit articles displayed by the current month/year

Currently I’m using the following to display my published articles for the current month and year:

<txp:article_custom month="2010-02" time="any" sort="posted" />

What I would like to do is have the month attribute auto update (every month and new year) so I don’t have to edit my code. Any suggestions?

Thanks.

Offline

#2 2010-02-18 11:41:39

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 638
Website

Re: Limit articles displayed by the current month/year

month='<txp:php>echo date("Y-m");</txp:php>'
But if you will not have any articles in the current month, it will not show anything at all.

Last edited by THE BLUE DRAGON (2010-02-18 11:56:41)

Offline

#3 2010-02-18 11:43:29

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: Limit articles displayed by the current month/year

Need to use single quotes for tags within tags;

month='<txp:php>echo date("Y-m");</txp:php>'

Code is topiary

Offline

#4 2010-02-18 11:57:02

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 638
Website

Re: Limit articles displayed by the current month/year

;)

Offline

#5 2010-02-18 12:26:37

Algaris
Member
From: England
Registered: 2006-01-27
Posts: 580

Re: Limit articles displayed by the current month/year

Thank you!

Offline

#6 2010-02-18 13:46:22

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

Re: Limit articles displayed by the current month/year


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

Offline

#7 2010-02-18 14:06:38

roelof
Member
Registered: 2005-03-27
Posts: 647

Re: Limit articles displayed by the current month/year

hello,

Or what i use in my website :

<txp:article_custom month='<txp:page_url type="month" />' sort="posted"  limit="99"/>

Roelof

Added bc. -Gocom

Last edited by Gocom (2010-02-18 14:35:05)

Offline

#8 2010-02-19 09:13:02

Algaris
Member
From: England
Registered: 2006-01-27
Posts: 580

Re: Limit articles displayed by the current month/year

Wow thank you.

uli: The month select menu isn’t quite what I’m looking for in this instance but it could prove extremely useful for other projects. Thanks for the link.

Next question (as I can foresee my boss asking about this). Is there away to limit the articles displayed to range from Monday – Sunday for the current week/month/year and auto update itself?

Basically I’m designing a What’s On page that will display all the current calendar activities and their dates between a specified time period, either monthly or weekly depending on what my boss decides on. All the information will be entered for the entire year in advance with future dates assigned to their articles and Textpattern will automatically handle hiding the old articles and displaying the new ones.

Thanks.

Last edited by Algaris (2010-02-19 09:14:04)

Offline

#9 2010-02-19 11:51:51

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: Limit articles displayed by the current month/year

Algaris wrote:

Is there away to limit the articles displayed to range from Monday – Sunday for the current week/month/year and auto update itself?

That is trickier. You could try the no-longer-supported chh_article_custom plugin; I’ve heard conflicting reports as to whether or not it works correctly in Txp 4.2.0. It has a start and end feature; you would need some additional work to calculate the start and end of the current week.


Code is topiary

Offline

#10 2010-02-19 13:17:37

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

Re: Limit articles displayed by the current month/year

Why don’t you have a look at the excellent smd_calendar plugin?

Offline

#11 2010-02-19 15:59:43

Algaris
Member
From: England
Registered: 2006-01-27
Posts: 580

Re: Limit articles displayed by the current month/year

Thanks for the suggestions. I’ll have to take a look at smd_calendar and see what it can do. Not too sure about having a monthly calendar on the page but if can give me more flexibility in displaying articles according to set date patterns I can definitely see a use for it in multiple sections of the site I’m working on.

Offline

Board footer

Powered by FluxBB