Skip to main content

Posts

Showing posts from June, 2009

Building a Content Management System Preview Function

I've recently had to build a preview function in a customer content management system, and came up with what seemed a fairly neat way of implementing this.

The principle requirement was to allow users to preview content without making the change to the underlying data in the database, so allow them to roll-back or amend their changes until they were happy with them. At this point they would publish and the records in the database tables that represented the specific article would be updated.

I planned to implement this using the Session object, in the following way:
User clicks to edit an article - an article object is instantiated fromt the database and bound to the form.User updates the information and presses the Preview button.In an IFRAME, the main website article template is loaded and via a querystring parameter it is instructed to use the Article object hosted in the session, rather than retrieving it from the database as it would in the normal public view.The user can then …