[development] Preview in Drupal

Steven Surowiec steven at digitalpulp.com
Wed Aug 12 18:07:08 UTC 2009


I'm currently working on a site and the client has insisted that being 
able to preview content is imperative. But, the preview must be within 
the front-end theme, not just spitting the fields at the top of the form 
as Drupal currently does (the site is being done in Drupal 5 and an 
upgrade to 6 is out of the question). The way we've done this in other 
CMSes is to setup a preview.domain.com sub-domain and then have that 
load the most recent drafts of all content, making preview very easy. I 
was thinking of using Drupal's revisions for this but could not find a 
way to save a revision without publishing it. So the way this would work 
would be if node A is at revision 1 and I hit the 'save draft' button it 
would save that content as revision 2, but wouldn't actually publish 
revision 2 until I later hit the 'publish' button.

I have a few ideas to do this with some custom code but was wondering if 
anyone has ever had to implement a real preview in Drupal before and, if 
so, how you got it up and running? The biggest problem I keep running 
into with all my ideas is how to handle saving new content as a draft, 
so I'd be interested in hearing how this was done as well if anything 
special needed to be done for new content vs existing content.


More information about the development mailing list