Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

instead with loop

Dear CDForum,

Can you help me with the following problem? I've tried the online documentation and everything but can't find a solution where I'm sure there must be one.

I have a list of job-openings. They disappear after a certain date. So far everything is just dandy. But now I want a message to appear saying something like: "No openings right now." instead of just a blank screen. How do I go about it?

Cheers,

Thomas van Putten
Monday, September 23, 2002

Can you use something like this:

http://discuss.fogcreek.com/citydesk/default.asp?cmd=show&ixPost=4138&ixReplies=5

I'm not sure I understand it, but maybe your job page would start with 'Number current job openings: "N"

tk
Monday, September 23, 2002

<script language="javascript"><!--
var tmp = "{$ foreach x in (all) $}.{$ next $}";
if (tmp.length==0)
{
  document.write("Sorry, currently no job openings<br>")
} else
{
  document.write("Currently ",tmp.length," job openings<br>");
//--></script>

Adriaan van den Brand
Monday, September 23, 2002

My appologies. Made a typo:

script language="javascript"><!--
var tmp = "{$ foreach x in (folder "jobs") $}.{$ next $}";
if (tmp.length==0)
{
document.write("Sorry, currently no job openings<br>");
} else
{
document.write("Currently ",tmp.length," job openings<br>");
}
//--></script>

(; after write and closing bracket } )

Please change condition folder "jobs" and messages with desired text.

Adriaan van den Brand
Tuesday, September 24, 2002

Thanks for the solution!

However, I would like something to work in CityScript
instead of javaScript.

It works fine though, If all else fails I will certainly use this!

Thomas van Putten
Wednesday, September 25, 2002

Let's hope Citydesk 2.0 will solve all limitations (and even more, that it will be available soon; preferably yesterday).
;-)

Adriaan van den Brand
Thursday, September 26, 2002

*  Recent Topics

*  Fog Creek Home