Fog Creek Software
Discussion Board

Knowledge Base
Terry's Tips
Darren's Tips

Can I do server side includes

I've never done a server side include and I have only a layman's idea of what it might do and how I might do it.  So question number one: Is there an SSI for Dummies webpage somewhere?

Question 2 is: Is there a good reason and a good method for doing it in CityDesk?

I'm about to change the heading of a fairly big site and I dread the long publish.  I expect the heading to go through several iterations and long publish cycles.

I keep thinking that if I could just do put an "include" in the heading of my templates and put the actual heading in a CityDesk article or .html file, the publishing would go quickly.  Can I do that?  Would Preview work?

Tuesday, February 4, 2003

You can do that, but previewing won't work. The server-side include means that the final file is "assembled" by the web server (it's server-side). When you do a local preview with CityDesk, you're just looking directly at the file.

One workaround is to get a web server running on your desktop. Windows NT/2K/XP Pro have this built in.

Joel Spolsky
Tuesday, February 4, 2003

Server Side Includes will help your publishing go faster if you use them intelligently. If you make all of the commonly updated aspects of your page Server Side Includes, then all you need to update is the Server Side Includes & the new pages.

It should also cut down on crunch time for CityDesk if your site is really huge.

For example, my website has a lot of different elements in the right & left column. Which means any time I update one of them every-single-one of the pages on my site gets republished. If I had SSI, the site would generate faster and upload faster.

Found this tutorial online:

Basically, wherever you want to include a file in another file, you add:

<!--#include file="subdir/file.ext"-->

That string gets replaced by the file, exactly like {$.var$} replaces a variable. I use the extension .inc for all my includes. This way you know exactly what it is.

CityDesk is great in that it can build relative links to any file on the server. Or you can make the links absolute... Best thing to do is experiment.

Sure you can't preview, but if you know the pieces that are server side includes, you can just fill in the holes.

I admit I've never done this with CityDesk, but I have worked a lot with Server Side Includes and a lot with CityDesk. Just never to gether. If you're familiar with CityDesk, Server Side Includes should be a breeze.
Tuesday, February 4, 2003

Oh one more thing. I thought of this trick a while ago but never did it because my hosting company doesn't support server side includes at my price level.

You can set them up with a account (which is free) and it can FTP in to your server. Create the account around your server-side-includes or pages and it can be used to update aspects of your page.

It'll take a little creativity to implement properly, but can be really cool if you do it right. has less complexity than CityDesk, but can be updated from anywhere, even a public terminal somewhere. This is great for something like a band's travel log... They can update it from the road. It also helps alleviate the 50 file limit in CityDesk.
Tuesday, February 4, 2003

Seems pretty easy.  Looks like I'd need to change the file type to .shtml to make it work.  This might really help in future sites.

Tuesday, February 4, 2003

A very good discussion of server side includes for Microsoft IIS servers is in Desigining Active Server Pages by Scott Mitchell (OReilly)

And in these articles:

and ...../082599-1.shtml

Joel Goldstick
Wednesday, February 5, 2003

*  Recent Topics

*  Fog Creek Home