CityDesk 2.0-Documentation
Determining Which Articles To IncludeThe following clauses may appear in the condition section of a forEach loop.
(all)
Returns all articles in the site.(today)
Returns all articles which were filed today, according to the computer's system clock.(publishDate)
Returns all articles which were filed on the publish date. This is different than today because it honors the date you specify in the Publish Dialog.(before today)
(before publishDate)
(before yyyy/mm/dd)
Returns all articles which were filed before a particular date.(after today)
(after publishDate)
(after yyyy/mm/dd)
Returns all articles which were filed after a particular date.(monthOf today)
(monthOf publishDate)
(monthOf yyyy/mm/dd)
Returns all articles filed in the same month as a particular date.(yearOf today)
(yearOf publishDate)
(yearOf yyyy/mm/dd)
Returns all articles filed in the same year as a particular date.Dates may be modified by appending +n or -n, where n is an integer indicating the number of days. This is a handy way to show the last n days worth of articles. For example, (after publishDate-14) can be used to list all articles in the last 14 days. As another example, suppose you are creating an events calendar and using the "Filed Date" field for the event date. Then you could show all upcoming events, starting today, within the next month using the condition (and (after publishDate-1) (before publishDate+31)).
(folder "foldername")
Returns all articles in a particular folder. For example, (folder "News") returns all articles directly under the folder named News.
To get articles from a subfolders, separate the folder names with slash (/) or backslash (\). For example, (folder "News/International"). For the top level folder, use "/".
Normally only articles directly under the named folder will be included. For example, if you have a News folder with two subfolders named International and Local, the condition (folder "News") will only get articles that are actually in the top folder directly, not the International and Local subfolders.
If you want to include all the articles inside a folder and all of its subfolders, add /* to the end of the foldername, For example, (folder "News/*") would return articles in News, News/International, and News/Local. This works for folders inside folders inside folders to any depth.
(thisFolder)
Returns all articles in the same folder as the article or file which is being generated now. In the example at right, you could use the same loop {$ forEach x in (thisFolder) $} in both the News/index and Weather/index articles. The list in News/index would include the four articles (index, New Tax on Garbage, etc.) while the list in Weather/index would include three (index, Hurricane, Today's Temperatures). To prevent an article linking to itself, combine this with thisArticle (see below), for example {$ forEach x in (and (thisFolder) (not (thisArticle))) $} .
(thisArticle)
Returns this article alone. This is most helpful in the form (not (thisArticle)) which can be added to any condition so that the index page does not list itself, for example, {$ foreach x in (not (thisArticle)) $} returns all articles in the site except this one.(keywordContains "keyword")
Returns all articles where the keyword field includes a particular word. Watch out for parts of words inside keywords: if your condition is (keywordContains "pain") it will match Spain as well. See Using Keywords Effectively.(author "name")
Returns all articles by a given author.(fileName "name")
Returns all articles with a given name. If name includes a slash (/) or backslash (\), it is assumed to be a full path to the article, for example, "/News/Headlines/King of Spain". If name does not include a slash or backslash, the condition matches all articles in any folder with the name, for example, (fileName "index") returns all articles with the name index in whichever folder they may appear in.You can create boolean clauses to combine conditions as follows:
(not (condition))
The exact opposite of condition. Includes precisely the articles that condition would have left out.(or (condition1) (condition2) ... )
Returns all articles that match either condition1 or condition2. You may list as many conditions as you need, but there must be at least two.(and (condition1) (condition2) ...)
Returns all articles that match both condition1 and condition2. You may list as many conditions as you need, but there must be at least two.You can also restrict the output to the first n results. This is done by putting a number before the name of the variable in your forEach statement, for example:
{$ forEach 10 x in (folder "News") $}
... returns the first 10 articles in the News folder.
©Copyright 2001-2003 Fog Creek Software, Inc. All Rights Reserved.