Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

Use variables in "folder" statement

Hi,

I plan to implement a Newsletter Site, which expands each time we send out a newsletter (perhaps once a month).

I want to organize my newsletters in seperate folders each (May, June...)  and want to use identical folder structures within each Newsletter folder (Articles, News, ...).

My problem is: It seems that I have to use a full folder name (starting from my "home" directory) in "folder" CityDesk Script statements - I would rather prefer to use "relative" folder names which start from the file-location where the creation process is currently underway.


Example

index.htm
- Newsletters
- 200305.htm
- 200306.htm
- 200305Dir
-- Articles.Dir
-- Trainings.Dir
- 200306Dir
-- Articles.Dir
-- Trainings.Dir

(where .Dir means "Directory" which contains Articles and .html means Articles).

I would like to have a loop within e.g. 200305.htm

{$ foreach X in (folder "Articles.Dir"$}      but I have to code
{$ foreach X in (folder "200305Dir/Articles.Dir"$}  [bad code]

Tried to work with variables, which aren't understood within the "folder" statement neither.

Any idea - do I do anything wrong?

Any input / help would be very much appreciated.

Thanks in advance

Volker Halstenbach
- Germany -

Volker Halstenbach
Monday, May 05, 2003

Why do you need it to be relative? Are you copying the same file to different folders or expecting your users to do the same? Is the folder structure changing that much?

www.marktaw.com
Monday, May 05, 2003

The folder structure stays the same from newsletter to newsletter - but the content (articles) change.

The solution I try to implement uses some kind of loop within a loop:
The first loop is within "Index.htm"
- the second loop (within the first) is in the articles which are referenced by the foreach statement of the first loop. These files reference a different (month-specific) subfolder ("May", "June"...) which themselfes contain identical subfolders ("Articles", "News",...).

By the way: "Never publish before / after" is not suitable, because we want to keep track of "old" newsletters.

Thanks again for your help and any suggestions.

Volker Halstenbach

Volker Halstenbach
Monday, May 05, 2003

I get it. You're creating a monthly newsletter where the month is the folder. You don't want to have to create/modify a new page every month for every newsletter, you'd just like to be able to copy the old one an use it without modifications.

Uh... As-is I can't think of anything off the top of my head to help you. I think that there will have to be *some* manual editing on your part no matter what method you choose.

Have you thought of creating a dozen newsletters ahead of time - a year's worth - and using neverpublish before on them? Or maybe audience so you can preview them locally?

www.marktaw.com
Monday, May 05, 2003

I've done similar things before. One tip is to put the newsletters inside the date folders, instead of outside e.g.:

index.htm
- Newsletters
- 200305Dir
-- index.htm
-- Articles.Dir
-- Trainings.Dir
- 200306Dir
-- index.htm
-- Articles.Dir
-- Trainings.Dir

This way, users can get to the newsletters using the URL "www.domain.com/200305/". It stops your main folder getting cluttered in CityDesk, too, as you can click on the little + symbol to roll up all the subfolders except the current one.

Darren Collins
Monday, May 05, 2003

An alternative way to manage this is to have only one Articles and one Trainings directory, at the root level of your site. You could then dump all your articles into them, and construct your newsletters using filedDate to determine which articles get included.

You'll need to be careful about setting the filedDates correctly, but it still lets you add articles for future newsletters without messing up the current newsletter. I've found it's easier to manage this sort of structure when I want to edit an old article, since there's only one directory to look for them in.

If you also use keywords in your articles, this structure makes it easier to create pages that list all articles about a given topic. For example, if it's a computer newsletter you might want to create pages that list all Mac, Windows and Linux articles separately. This helps your readers later, as they really aren't interested (and won't remember) in which month a given article was published, they'll want to look for information by topic.

If you use this method, you can ignore my first suggestion above :-).

Darren Collins
Monday, May 05, 2003

Hi -

this is an interesting thread because I would like to use CityDesk for a monthly newsletter as well. It seems that there's no easy way of supporting "edition" management. Ideally, after the November edition is published, you'd set a variable to "December", and then refer to that variable inside inside the folder statement.

I notice that this thread ended last May. Is there any current thinking on how to support edition management in CityDesk? I'd love to hear about it.

Brent

Brent Klassen
Saturday, November 08, 2003

*  Recent Topics

*  Fog Creek Home