Fog Creek Software
Discussion Board

Knowledge Base
Terry's Tips
Darren's Tips

Grouping articles by date

I want to list out a directory of articles showing the month name as a separator:

  1/22/2004 - An article I wrote
  1/5/2004 - Some earlier article
  1/1/2004 - Happy New Year

  12/25/2003 - Merry Christmas
  12/10/2003 - Shopping nightmare

... and so on.

Is there a way to do this without resorting to using Extra fields?  I'm working on a site where my client will be publishing their own articles and I don't think I can rely on them remembering to add Extra field content when they add articles.

Wade Winningham
Thursday, January 22, 2004

This might be a bit too clumsy for your needs, but I do a similar thing for years:

{$foreach x in (and (folder "articles") (after 2002/12/31) (before 2004/01/01)) SortDescendBy .fileddate$}
{$ if nonblank x.body $}

This gives me everything in 2003.

You could do the same for months. Then all you'd have to do is set up the directory listing stuff for each month. The users don't have to remember to do anything special

Pat Galea
Thursday, January 22, 2004

This is one of the as yet unattainable holy grails for CityScript. The script many want would "show the month, all the articles for that month, show the next month, show all the articles for that month ....

You can make a list like you want, but it takes some some brute force work, like doing a script for each month But there is no built-CityScript function that does it elegantly. A very heavily requested feature. Folks handy with Javascript, php, asp or whatever can find a way to do it I'm sure.

Thursday, January 22, 2004

I just ended up changing the design of the page to work within the limitations.  I'll post a link up to the site when it goes live next week.

Wade Winningham
Friday, January 23, 2004

*  Recent Topics

*  Fog Creek Home