Fog Creek Software
Discussion Board

Knowledge Base
Terry's Tips
Darren's Tips

Use (folder) variables in a loop

I would like to be able (apart from if-then-else constructions ofcourse! :-) to use something like this....

{$ foreach x in (folder "{$this.foldername$}")$}

or using the {$.extra1$} value for example:

{$ foreach x in (folder "{$.extra1$}")$}

It seems quite simple...

Is there any way of doing this (using the 'current folder/file')?


Wednesday, February 26, 2003

Whoops This is about the tenth time this is asked... sorry...

(I did read a lot of forum posts before posting this question, rellY!)

So it cannot be done huh??

Wednesday, February 26, 2003

You might want to take a look at these threads, the last one shows how to implement breadcrumbs in javascript using foreach...

David Burch
Wednesday, February 26, 2003

Wow! it works fine, but it just seems so complicated for such a  'simple' task.

If just... ;-)

Why can I use CityScript in a 'keyword_contains' thing, but not in a 'folder ' thing??

This works:

...blah blah... keyword_contains "{$.extra1$}"

But this doesnt:

...blah blah... folder "{$.extra1$}"

Why is that?

I have also tried to use slashed ("/" and "\") or dots (".") in the folder syntax, like ; folder "./"
doesn't work....

I could fix it using :

{$ foreach x in (keyword_contains "{$.extra1$}")$}

and then fill in a keyword and an exact {$.extra1$} variable in every file, seems like a lot of extra work (which is easily forgotten!)

Anyway, thanx for your help! ;-)

Wednesday, February 26, 2003

I'm not sure you can use a variable in cityscript as you suggest...

the folder thing is probably an oversight. the next version is sure to have it as it's probably the #1 asked for feature.
Thursday, February 27, 2003

Here's another example of using a combination of JavaScript and a CityDesk script foreach to build a SiteMap.  It could be modified to obtain folder information:

David Burch
Thursday, February 27, 2003

*  Recent Topics

*  Fog Creek Home