Fog Creek Software
Discussion Board

Knowledge Base
Terry's Tips
Darren's Tips

feature: parameterized variable

There are two things I'd love to see in a CDV2: support for "if" in cityscript and parameterized variables. "If" would be great for making complex foreach loops (I've wanted this a couple of times).

Parameterized variables would be extremely nice. Then I could do fancy stuff without a lot of work. Right now I have (in my index.html and a couple of other summary pages):

    <table width ="100%" {$.TABLESTYLE$}>
      {$foreach 15 x in all SortDescendBy .fileddate $}
        <A href="{$$}">{$x.headline$}</A>

I originally tried to stick this in a variable. In addition to what appears to be an 3rd-level of evaluation problem in the variable, I wanted to be able to specify the condition (which was a different folder) for the various places in which I would use this variable. So I'm looking for a way that I can put the above into a variable, replace the "all" with a "(folder {$.FolderName$})", and "pass in" FolderName when I use the variable. Something like:

{$.Foreach_InFolder "articles"$}

Where Foreach_InFolder is defined as a parameterized variable. I'm not sure how many people would use this (I'm a programmer, so I'm used to this kind of thing).

I'm also not sure how tricky it would be to guarantee that all the levels of substitution can actually be resolved at publication time. I can see this getting complicated quickly if the argument passed to the variable is itself a variable...

Brian St. Pierre
Wednesday, February 13, 2002

Recursive iteration on CityScript seems to be the 2nd most requested feature enhancement.  #1 is being able to name my own files.

Joel addressed the recursion issue a while back.  I can't find the article but it went something like

CityScript parsing only runs twice.  I can make it recursive without a lot of work but I will need to make sure that there is adequate infinite loop detection.

Not sure if it is in the next release but I know it is definitely on the radar screen.  Main request has been for handling multi-level navigation.


Kevin Sherwood
Wednesday, February 13, 2002

Fantastic idea Brian. That would simplify my site incredibly.

Darren Collins
Wednesday, February 13, 2002

Great Brian.  I would just add a CityDesk keyword: "This_folder"

Wednesday, February 13, 2002

TK: this_folder would work for the example that I gave, but there are other things that you could do with this. Imagine a parameterized "author" variable:

{$.Author "brian"$}

might be defined as

<a href="{$.Author_Bios_Dir$}/{$.auth_name$}">{$.auth_name$}</a>

Where auth_name is the parameter name inside the variable definition. This all relies on arbitrary variable nesting depth, of course. Add an "if" construct, and you've almost got yourself a real programming language... which might be something they want to avoid, given their target market.

Brian St. Pierre
Thursday, February 14, 2002

Oh yes, I'm with you.

I have a feeling that this sort of feature came up early in the FogCreek brainstorming sessions.  We'll never see it, but it would be great to see the proposed features they crossed out in order to meet the ship date.

Thursday, February 14, 2002

See, now this is where my brain starts turning to putty, and if CityDesk implemented this I would start thinking that I might as well learn PHP and start hosting somewhere that supports PHP.

Hopefully this wouldn't break any of the current functionality (It doesn't look like it would), and there would still be the simple version of the tutorial so I wouldn't feel obligated to learn this stuff. (Which may or may not be that hard, I actually kinda skimmed this thread.)

Mark W
Thursday, February 14, 2002

Most teams develop products with the experts in mind, but forget the average user. One of the things I love about CityDesk is it's focus on the average user. Not to say support for parameterized variables should never be added, but it should wait until the average user is well served.


Alan Armstrong
Friday, February 15, 2002

Hopefully the kindly Fog Creek people would implement more advanced features like these in such a way that if you don't need to use it, you don't need to learn about it. That way new users can dive right in, while the advanced users have the control they need.

Darren Collins
Sunday, February 17, 2002

*  Recent Topics

*  Fog Creek Home