Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

Creating Automatic Archive

I'm creating an email newsletter which will be sent out once a month or so, and I'd like to create a page which automatically archives the newsletters. Maybe I'm just getting tired, but I can't figure out how to have the Issue number [i.e. Issue 001] appear only once and the articles in that issue appear underneath.

The archive would look something like this:

Issue 001
    * Article 1 Headline [and maybe subheads]
    * Article 2 Headline
    * Article 3 Headline
    * Article 4 Headline

Issue 002
    * Article 1 Headline [and maybe subheads]
    * Article 2 Headline
    * Article 3 Headline
    * Article 4 Headline

Issue 003
    * Article 1 Headline [and maybe subheads]
    * Article 2 Headline
    * Article 3 Headline
    * Article 4 Headline


The CityDesk file structure:
Issue_001 [folder]
    * index [issue's home page]
    * index_email [page which gets emailed]
    * article_01
    * article_02
    * article_03
    * article_04

Is this clear? And can it be done?

Thanks in advance,
Eric Saul

Eric Saul
Thursday, December 11, 2003

In each folder, include this in your index file


{$foreach x in (and (filename "index") (thisFolder))$}
  <h2>{$x.headline$}</h2>
{$next$}

{$foreach x in (and (not (filename "index"))(thisFolder))$}
  ... x.headline, x.teaser here ............
{$next$}

joel goldstick
Thursday, December 11, 2003

Joel is on the money, you'll need to copy a script every time you add a new newsletter.

In CityScript there isn't yet a way to do a set-and-forget script that manages your future newletters so that you could just add your next newsletter folder. For now you'll need to use Joel's method.

tk
Thursday, December 11, 2003

It's worth sticking a script like that into a variable. This has two benefits:

1) It's easier to insert a variable than to copy and paste a big chunk of script.

2) If you want to change the formatting or something, you only need to change it in the variable definition, not on every index page.

Darren Collins
Thursday, December 11, 2003

Very thoughtful, excellent point!

joel goldstick
Thursday, December 11, 2003

joel goldstick :re Automatic Archive

Joel, not sure I understand how your code does an "Automatic Archive".

In my way of thinking when one archives ... this mean that it [whatever] has "expired" and then stored as archived items somewhere for retrieval at some time.

Please explain? Thanks

David Mozer
Thursday, December 11, 2003

my suggestion is not automatic. and darren's reply is, i think , a better solution.

with cd I don't know how to be automatic with this issue.  But if you are willing to create an index file with something like my idea (and made simpler by darren's idea), you can accomplish the original thought.  But i agree, not automatic

joel goldstick
Friday, December 12, 2003

*  Recent Topics

*  Fog Creek Home