Fog Creek Software
Discussion Board

Knowledge Base
Terry's Tips
Darren's Tips

which variable could do this?

using a foreach loop i determined a page (lets say article page) to index several articles. The number of articles that appear varies, depending on how much have been added over the last seven days (the condition is "after today-7").

On a different page, i inserted a sentence like this: "number of issues we are working on - #". In place of "#" there is a concrete number that equals the amount of articles indexed on the article page.

I would like to have the # to automatically adopt the correct number matching the number of articles on the article page.

How could i do this? What kind of variable do i have to define? (In general, is there a list of collected variables? In the documentation i did no find it.)

I appreciate any advice and hints.

Tuesday, November 04, 2003

CityScript can't do counting.  A long time back, there was a thread using javascript to do this.  This will show you how you can do it.  Rather than using the writeln within the loop you could just insert a javascript statement to write the i value where you like in your markup.

Of course, if the user doesn't have javascript, or it is turned off, this won't work.

<script type="text/javascript">
var i = 0;
{$foreach x in (thisFolder)$}
<script type="text/javascript">
document.writeln ("filename: {$x.filename$} ");
document.writeln ("index: " + i + "<br>");

Joel Goldstick
Tuesday, November 04, 2003

*  Recent Topics

*  Fog Creek Home