Module saves themed Drupal pages to files

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
awolfey's picture

I've made a D6 module called htmlsave that allows the user to save a page to a file. The file contains the fully themed page and includes all page elements available to that user.

Yes, you can do the same by clicking File and save on your browser, but this allows much more flexibility.

The original use for this was a client who wanted to use Drupal as a versioning system for html emails he was creating. His colleagues would edit the drupal page, and then when done someone would save that page to a file. In this case the file output was themed to include basic html page elements, a cck field with all the css, and the node body. The file would then be pasted in their email blaster. The email would also link back to the static page for people who can't read html email.

(I tried to talk him out of this approach because of the limits of wysiwyg editing, but he wanted to do it anyway. He ended up doing something else.)

Themeing is where you would have to apply your creativity for your purpose.

Nevertheless, I finished up the module and am happy to contribute it if anyone thinks there would be a use for it. Some rough ideas: Use Drupal as a very basic web publishing platform, save static versions of drupal pages for some historical or off-site use.

Possibilities not yet realized are: token support for automatic file naming, auto filesave so every node save also creates a static file.

I also thought I might port the drupal_ftp module (http://drupal.org/project/drupal_ftp) to D6 and use it in combination with my module, but I doubt I'll do that now with my client having abandoned the project.

This is my first module, so I would appreciate any comments.

Thanks

Comments

Could you clarify why your

Garrett Albright's picture

Could you clarify why your approach "allows much more flexibility" over just saving from a browser?

Good point. How about "some

awolfey's picture

Good point. How about "some more flexibility?"

The file is saved to the site's file path where it is available to others, not to the user's pc.
The output can be themed so the file could be anything from plain text to a full drupal page.
It maybe easier for end users to share a file this way. I think it all comes down to manipulating cck fields and the templates.

Very pared-down output would probably require a separate edit/add template. Hmm, maybe the settings should allow you to set which templates to use for output. Then you could edit and view with page.tpl.php but save with page-output.tpl.php.

Hmm, okay. I think I get it.

Garrett Albright's picture

Hmm, okay. I think I get it. It sounds like a module with limited appeal, but if it solved your problem, it can probably solve someone else's as well.