Friday, 2 March 2007

Setting up xssi parsing for included files

I've set this up a few times now and sometimes it takes me a while to remember what steps were required to make this work... so here are some rough notes:

httpd.conf must have the mod_include module loaded (so this needs to be copied / compiled if not in there automatically)

LoadModule include_module path/to/apache/mods/

"Include" needs to be added to your options

Options Indexes FollowSymLinks Includes

<IfModule mime_module>
# this section should contain the following:

AddType text/html .shtml .sssi
AddOutputFilter INCLUDES .shtml .sssi

# so any includes named *.sssi will be parsed by apache

After an apachectl restart, you can make a page called test.shtml which contains this call:

<!--#include file="includes/footer.sssi" -->

And footer.sssi can contain something like this:

<!--#if expr="{$QUERY_STRING} = /printenv/" -->
<div id="debug-footer">
<h3>Debug Footer</h2>
<p>File last modified <!--#flastmod file="$DOCUMENT_NAME" --></p>
<pre><!--#printenv --></pre>
<!--#else -->
<h3>Standard Footer</h3>
<!--#endif -->

Now when you open test.shtml?printenv you'll see your environment variables.

Opening a new browser window and maximising it..

I'm usually vehemently against this method of web development (never, ever break the back button!) but someone I know wanted to do this for their client, so I worked out a solution - I've pasted the code here so I can dole it out as and when needed... Obviously the usual disclaimer applies: don't do this unless you really have to!

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">
<html xmlns="" xml:lang="en" lang="en">

<title>Home page</title>
<script type="text/javascript">

var uri;
var myWindow;

function openme(uri){
myWindow =, 'myWindow', 'toolbar=0,status=0,width=800,height=600')
if (navigator.appVersion.indexOf("Mac",0)>0) {
} else {



<h1>Index Page</h1>
<a href="javascript:void(0)" onClick="javascript:openme('home.html')">open me</a>
<p>This opens a new browser window</p>