jump to content

Note:This code is here only for history's sake. Please see a better (read "working") idea.

Even if you are like me, with site hoster not providing Zope services, you can use Zope to build a structured site quickly. Here is a unix shell script to make a static site from a Zope server. You need to specify all common images (like buttons, rules etc.) using full URL. Otherwise, wget will replicate those images in all the sub-directories.

# Makes a static site out of Zope site
# 
## the URL for my Zope site
BASE_HREF="http://tux.leesburg.pike:8080/vsbabu"
# recursive suck
echo "Getting Files"
wget -nh -m -A ".html,.php3,.txt,.jpg,.gif" ${BASE_HREF}/index.html 
#for some reason, stylesheet is not caught above!
wget -nh -m ${BASE_HREF}/stylesheet.css
echo "Modifying Files"
cd tux.leesburg.pike/vsbabu
for fil in `find . -name '*.html'`
do
    echo "$fil"
    bakpath=`dirname "$fil"|perl -pe "s|\w+|..|g"`
    perl -i -p -e "s|<base\s+href=".*?">||gi" ${fil}
    perl -i -p -e "s|$BASE_HREF|${bakpath}/|g" ${fil}
done
#PHP files are processed differently
for fil in `find . -name '*.php3'`
do
    echo "$fil"
    bakpath=`dirname "$fil"|perl -pe "s|\w+|..|g"`
    perl -i -p -e "s|<base\s+href=".*?">||g" ${fil}
    perl -i -p -e "s|$BASE_HREF|${bakpath}/|g" ${fil}
done

There is a ZMirror product, but it did not work well for me. What I did was to name all my HTML documents as .html, and keep index.html as the default document. All the images are declared with respect to the dtml-var called currhost, which has the location of my Zope home; and not using the dtml-var tag for images.