Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

How to create an "if this field exists" script.

I want to create a sidebar, but only if there is a sidebar, so I set it up this way:

{$ foreach x in (filename "{$x.filename$}") $}
<table width="96%" border="0" cellspacing="2" cellpadding="2">
        <tr bgcolor="#000000">
          <td><font color="#ffffff">{$x.sidebar$}</font></td>
        </tr>
      </table>
{$next$}

It seems somewhat inelegant, is there a better way to do this?

Mark W
Friday, February 01, 2002

We don't really have a way to do that in CityScript. I'm not sure why (or whether) your script would or should work!

Joel Spolsky
Saturday, February 02, 2002

Yeah it works, believe it or not.

Mark W
Saturday, February 02, 2002

I'd love to see 'if' statements in a future version of CityDesk. Thanks for the workaround in the meantime, though!

Darren Collins
Sunday, February 03, 2002

*  Recent Topics

*  Fog Creek Home