Fog Creek Software
Discussion Board

Knowledge Base
Terry's Tips
Darren's Tips

Two missing things

Here are the two things still missing from SP1, that would not only make my experience a lot better, but are probably relatively useful for the general public.


I've seen this come back quite a few times, and it always comes down to something like this:

{$ foreach x in ... $}
{$ foreach y in {$ x.someAttribute $} $}

My need is similar. I have places where I have duplicated code all over the place simply because I can't do this.


I've seen this one come up a few times too. I want a CityScript construct like:

{$ foreach x in (folder-and-subfolders "foo") $}

For me, it's because I keep a heirarchy of articles (articles / year / month, i.e., "articles/2002/01" or "articles/2001/11"). Right now, I have to add (and duplicate) code every month so I can build my RSS file. In fact, I'm not doing precisely what I want, because I can't, which would be:

{$ foreach 15 x in (folder-and-subfolders "foo") $}

Because I have to have multiple foreach clauses, I can't effectively limit the entire list to 15, so for the moment, my RSS file contains all my articles. Okay, I'm not overly prolific (about 30 articles), but the RSS file is already 16k. I couldn't imagine having a site as busy as Joel's and trying to do this. I'd either put all my articles in one huge folder (scales poorly for my brain) or basically just only keep the most recent months in there that give me "more or less around 15". Ick.

If I had both of these things, I'd be very very happy. So what's next... SP2? Or v2.0? Is this stuff even SP2 style stuff?

Brad Wilson
Sunday, March 24, 2002

I sympathize but even a simpler

(folder "{$.anything$}")

would do it for us, no need to relate to the loop (x) at all. Basically if parsing {$.body$} and all the other "static" variables is possible for CD why not a simple string replacement of {$.anything$} within a condition at the same time. Once only, before starting the loop. I can't see the difference if CD does parse the statics first and does the loops in a second swoop. One could go as far as to stipulate that references within a condition are not allowed to contain HTML or script, just plain text taken from the current article field.

Best Regards

Patrick Thomas

Patrick Thomas
Tuesday, March 26, 2002

I go into this into greater depth in another thread, but if they parsed all static and then all dynamic variables what would they do when the static variables contain other static or dynamic variables?


where {$x.extra1$} includes another a loop (which they'd also have to parse on the spot or else the {$x.body$} won't be right and so on....

Basically, you'd be changing the fundamental logic behind CityScript and a lot of sites would behave very differently. It's fairly subtle and very fundamental.

That is... as far as I can tell, I didn't develop CityDesk so I don't really know.

Mark W
Tuesday, March 26, 2002

Thats why I stated that variables-in-conditions could be limited to include text only, no scripts/html...etc in my last sentence. Just string replacement, no further parsing, if its in a foreach condition.


Patrick Thomas

Patrick Thomas
Wednesday, March 27, 2002

*  Recent Topics

*  Fog Creek Home