Fog Creek Software
Discussion Board

Knowledge Base
Terry's Tips
Darren's Tips

Hiding CityScript from users, adding comments

I've only been using CityDesk for about two days, but I've already run into a problem where I wanted to either hide cityscript in an article from the user who will be editing the website (to keep them from accidentally changing things) and possibly leave them note (not visible to viewers) to tell that that they shouldn't even TRY to change things.

I couldn't find anything documented here, so I'll post my solution. You all may think that this is too obvious to be worth posting, but maybe someone will find it useful. Feel free to point out problems.

First, to hide the city script, we create two variables, 'beginComment' and 'endComment' consisting of '<!--' and '-->'. Then you code your script like this:

<!-- {$ .endComment $}
{$ more scripting here $}
{$ .beginComment $} -->

The end result is that the CD HTML editor reads it as a comment, but the comments are stripped when it's processed.

Then to leave a note to my users, I enclose the note with div's like this:

<div class="no-show">Hi There</div>

In an external CSS file I set the no-show class to display:none. This won't work for non-CSS aware browsers, but the site uses CSS for layout anyway, and I've stopped worrying about catering to the 3 people in the world who still use Netscape 2.0.

Dave Burnham
Saturday, December 11, 2004

I normally just put all the cityscript in templates only, so that the content editors aren't aware of it when they add articles.

Matthew Lock
Sunday, December 12, 2004

*  Recent Topics

*  Fog Creek Home