090978.org - A weblog about developing umbraco - an open source .NET based Content Management Platform, written by Niels Hartvig. Click here to get back to the frontpage of the weblog

1.20.2005
Q: Does umbraco create static html pages Permanent link to this post with (0 comments )
A couple of weeks ago I was asked if umbraco could create static html pages, and the answer was that it wasn't a build-in feature. Now why would anybody need static html pages you might ask - but think about this; a large organization or university could use one Windows server running umbraco for managing all sites, but when pages are published you could copy them to small servers just running Linux. Of course this would only work for absolutely static content, but it could be a need feature...

How to make it work
Now umbraco might not support static pages as a build-in feature but because of the simple API and because umbraco has an internal ActionHandler, it's really easy to create that feature - even without open any source.

A tiny backgrounder on ActionHandlers
An actionHandler is called whenever umbraco does something like publishing, creating, deleting and so on. By creating a class that inherits an interface called "umbraco.BusinessLogic.Actions.IActionHandler" and copy the dll into the /bin folder, your actionHandler is registered - true plug-in architecture, no configfiles used!

The IActionHandler is really simple:
- string HandlerName() - Should just return whatever you want to call your handler
- umbraco.main.IAction[] ReturnActions() - This is an array with the Actions that you handler supports. By returning the PublishAction, your handler will be invoked whenever umbraco publish anything
- bool Execute(Document, IAction). This method is called when umbraco does anything that your handler should support.

So the ActionHandler that will be able to create static pages on publication looks like these 91 lines (including comments and VS.NET generated code): saveStatic.cs. As stated in the comments part of the code it needs some more work, but as a proof of concept I think it does the job. And hey - it works! You could also use actionHandlers to create your own specialized work-flow or automatically send mails when news are published...

0 Comment(s)...


Comments: Post a Comment


Older stuff here...

empty gif for design I love umbraco... Click here to go to the developer site

More banners here...


To the weblog frontpage
Email / Contact info
umbraco - my company
Call me through Skype
Blog archive
RSS Feed RSS Feed





commonme.org
publicMIND
urgent.dk
asynkron
Hr. Röser
Interbreed
OpenLife
Loudthinking
BlogBot.dk



Tim O'Reilly - and his books
steve mcconnel
joel spolsky
steve jobs
bruce eckel


Blogger for peace - support the opposition against the USA war for oil

This work is licensed under a Creative Commons License

empty gif for design
empty gif for design empty gif for design empty gif for design