Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

A page that I just can't do?

I'm collecting scripts from the forum.  I put each script in an article in the folder "Bafofscripts"

I want to show all of the scripts on one page so here is the script to do that:

$foreach x in (folder "Bagofscripts") $}

{$x.body$}

{$next$}

I'll never link to the individual script articles, I don't really want publish them, I don't want CityDesk to evaluate the scripts in the articles either - they are just examples.

So, I set "never publish after" to last year.  I expected CityDesk not to evaluate the scripts in the "never publish" articles.  It does though and generates bunches of errors and will not publish the site.

OK, I'll add {$$}'s where they belong in the individual script articles.  That stops the publish errors, but now my page lists all of the scripts show the {$$} and it's not pretty.

Any suggestions?

Terry Kearns
Thursday, January 10, 2002

I think you probably meant to set each article that contains a script example to be "never publish after xxx" otherwise it publishes them also (and thats where the error comes from).

Every article is always published, unless for a particular article you tell CD not to publish it.

Michael H. Pryor
Thursday, January 10, 2002

Re checked my "never publish after" they were all set to 1-1-02.  But now it publishes without errors.  (It's a tragic thing to lose one's mind.)  But I din't change a thing between when I closed it with bunches of errors and when I reopened it just now and have it work!!

Leave that aside, now the script that lists the ($x.body$} of all of my script articles will not show my "never publish after" script articles.  I get a blank page, which is what I should get, of course:
http://tk-jk.net/city/Articles/fog0000000077.html

I think I need another plan.

Terry Kearns
Thursday, January 10, 2002

You could make a template called "blank" which was completely blank.

The pages will still publish but they'll be 0 bytes.

I was thinking of a possible solution to this for a future release: we would change CityDesk so that if you set the Template to (none) we just don't publish a file at all.

For backwords compatibility, we would create a template called BodyOnly containing {$.body$} -- which is what happens if you have no template now. All 1.0 citydesk files imported into the new version that have "none" templates would have their templates set to BodyOnly. This would ensure that on existing sites, we were 100% backwards compatible. But if you wanted to make articles that don't get a file, you could use (none).

What do people think of this idea?

Joel Spolsky
Thursday, January 10, 2002

Just make the new template's name "don't publish" then, we might like to have a view: "articles that don't publish"

Terry Kearns
Thursday, January 10, 2002

I did it.

It didn't work with setting the template to none.  So I made a new template called, "For articles with non-evaluating script (xyz)"  I made the file extension "xyz."  Then I removed the "don't publish after" check box.  City still tried to evaluate my individual script articles.

Then the clincher is that the blank template had to be totally blank.  I removed {$body$} from the new template, and finally all the html from the template.  That made the published file sizes 2 bytes long

Here it is:
http://tk-jk.net/city/Articles/fog0000000077.html

Send me your cool scripts and what they do and I'll publish them or link to them.

Terry Kearns
Thursday, January 10, 2002

I like your idea, Joel.

I've been adding small daily articles to a directory called Blog, which I then collect together in monthly pages using CityScript. I also display the most recent 10 entries on my site's main page. But I don't want lots of small articles uploaded to the server, since I never link to the individual articles.

Darren Collins
Friday, January 11, 2002

Joel's idea of setting the template to none is not bad, but may I suggest a more intuitive solution to control whether a page is published: an extra check box on the Properties tab, something like "Publish? Yes/No".

As I feel it, it would be much clearer that a field “Publish Yes/No” would control whether an article gets published than setting the template to none. In addition, I guess it's rather easy to implement: it's just an extra field in the database, to be checked when articles are rendered.

I’m very interested in having control over publishing too but for a different reason. See the topic I created yesterday: “Preventing articles in draft stage to be published”.

BTW: having control over your environment does make you happier. As Joel said on User Interface Design for Programmers, Chapter 1: Controlling Your Environment Makes You Happy.

Paul Iliano
Friday, January 11, 2002

If you do go with the 'no publish' idea then being able to set a directory as non-publishable could be useful.  Then dropping the files into that directory would save having to set the properties of them, you could then also move them out to be published with minimum fuss if you want.

Colin Newell
Saturday, January 12, 2002

I should add that in the meantime I tried controlling whether or not an article gets published, by creating different audiences (like Public and Private), and it works very fine!

Via the Publishing Locations, you have total control over whether these 'private' articles are published or not, or even to which separate server or folder, like for evaluation by others.

Paul Iliano
Sunday, January 13, 2002

I like this idea. I'd like to have a monthly page that contained the individual articles, but without uploading the article files themselves.

Was this every implemented?

Nick Delany
Friday, February 07, 2003

*  Recent Topics

*  Fog Creek Home