I use Template Toolkit (Perl) and have a simple script that generates static files from the templates. This is great for the situation you are in (common navigation etc etc).
It comes with a ttree
command that'll process a directory tree and put the results in another.
Here's the tt.rc file I use:
# ignore these files (regular expressions)
ignore = \.svn
ignore = ^#
ignore = ~$
ignore = .DS_Store
ignore = \.tt$
# if these template files change, reprocess everything
depend *=tpl/wrapper,tpl/defaults,style/default.html
# just copy these files, don't process as templates
copy = \.(gif|png|pdf|jpg)$
# verbose output
verbose
# recurse into subdirectories
recurse
# setup some defaults from tpl/defaults
pre_process = tpl/defaults
# process this file instead of the real file (see below how this is used)
process = tpl/wrapper
# process files from src/, output to html/
# extra templates in lib/ (tpl/wrapper for example).
src = src
dest = html
lib = lib
A couple of special files, tpl/defaults
is
[%- page = {
title = template.title,
style = template.style or 'default.html'
};
base = INCLUDE tpl/base_uri;
# don't include any whitespace from here...
RETURN;
-%]
And tpl/wrapper
is
[%- content = PROCESS $template;
IF !template.name.search('.html') OR page.style == 'none';
content;
ELSE;
default_style_template = "style/" _ page.style;
PROCESS $default_style_template;
END;
%]
This will process the real template; put the results in the content
variable and then process the style
template (set with page.style
in tpl/defaults
; defaults to defaults.html
).
the lib/style/default.html
style file just needs to have
[% content %]
somewhere to include the real template; before and after that you can have the standard footer and headers.
You can read more about Template Toolkit at tt2.org.
Another option would be to use wget
(or similar) in recursive mode to "mirror" pages generated by PHP on the development server; but I wouldn't recommend that.