Fog Creek Software
Discussion Board

Knowledge Base
Terry's Tips
Darren's Tips

"also in this section" indexing with CityScript


I'm impressed with CityDesk, but there's just one thing I'd
like to do that it doesn't support - an "in this section" index that's generated by cityscript within an article template.

You can't write a loop that only iterates over the articles in the current directory.

2 possible solutions spring to mind:

- Adding a pseudo-variable to cityscript that represents the "current folder".
- Provide a test for whether an article falls within the current folder.

Another solution might be to extend string matching so we could do substring tests on the article URL.

Dafydd Rees
Tuesday, December 03, 2002

If I undestand you correctly, you can select articles in any directory. Look at this:

Latest Additions Entries
{$foreach 3 x in (and (folder "addition") (not keyword_contains "(Index)")) SortDescendBy .fileddate$}

{$x.headline$}{$if nonblank x.teaser$}:


Previous Additions Entries
{$foreach x in (and (folder "addition") (not keyword_contains "(Index)"))$}

{$x.headline$} ({$x.filedDate$})


John Cesta
Tuesday, December 03, 2002

John has the solution for now but we've been looking for the generalized solution "from_this_folder" so we could write a "one size fits all" script where you didn't have to enter the folder name.  I'm sure there are much better ways for Fog to solve this than I can think of.

Tuesday, December 03, 2002

I've never tried it but does dot work?

You mean you want a variable that expands to the current folder name so yoiu can pop the script into any folder?

John Cesta
Tuesday, December 03, 2002

Precisely - so that the script can form part of an article template that can be used in many folders.

Dafydd Rees
Thursday, December 05, 2002

What would also be nice would be a way to recurse all the sub folders in a parent without having to specify all the folders within the parent like:

{$foreach 3 x in (and (or (folder "mryan")(folder "mryan\school_stuff") (folder "mryan\bday"))

Maybe like:

{$foreach 3 x in (and (or (folder "mryan\*")


John Cesta
Sunday, December 08, 2002

*  Recent Topics

*  Fog Creek Home