Photos / Photo Art / Reviews / Tips / Tutorials
Copyright ©2002
by Stuart Greenberg
All Rights Reserved.
JavaScript and CityDesk
Thursday, April 25, 2002

I put this together in response to a couple of posts on the CityDesk discussion board. One asked about storing additional data within a CityDesk article. For example, information about an employee that could be used to create a directory. The article itself would display detailed information about an employee. Since CityDesk has a fixed number of fields available it would be difficult to store the additional data in with the article.

The solution I came up with uses JavaScript statements in the Extra1 field. Each statement saves a data item in a JavaScript variable. The statements are rendered onto a web page within a ForEach loop setting the sets of variables for each person. Additional JavaScript code on the page displays the data.

The second request was to count the number of articles rendered in the ForEach loop. I do this by incrementing a JavaScript variable each time an article is rendered and displaying the result after the loop completes.

The sample .cty file demonstrates these concepts. Take a look around and if you have any questions, feel free to email me.

Click here to download the example .cty file for this tip.