A humble script that opens your webpage and sucks in parts of it and saves the HTML into a DTML Document.
The id of the DTML Document will be the page name of the URL +_static. So, if you open /web/doc/index.html the id of the DTML Document will be index.html_static. Be careful not to request URLs like: www.server.com/. Use instead www.server.com/index_html to be explicit.
_static
index.html_static
Then, to use it in DTML for example you do this:
<html> <dtml-if "_.has_key('index_html_static') and REQUEST.QUERYSTRING==''"> <dtml-var index_html_static> <dtml-else> <!--DYNAMIC-CONTENT--> <dtml-var expensive_resource_heavy_looper> <!--/DYNAMIC-CONTENT--> </dtml-if> </html>
To create the static DTML Document, you first need to create an External Method Id: update_staticpage, modulename: update_staticpage, functionname: update_staticpage Here's how:
context.update_staticpage(context.web.doc.index_html.absolute_url())
or:
context.update_staticpage(context.web.doc.index_html.absolute_url(), container=context.somefolder)
Alternativly in DTML:
<dtml-call "update_staticpage(web.doc.index_html.absolute_url())">
This is a very untested and simple script. It's idea is simple and anybody is free to do whatever they want and need with it.