we will start with a DD4T implemenation soon (Tridion 2011 SP1, MVC4, .NET 4.0), but one (hard) requirement from the client is that the preview of a page in Tridion CM context is working. The default preview renders - of course - the XML that will be published to the broker. Could anyone give some instructions/examples/pointers on how to implement such a preview in Tridion CM (if possible in the first place!).
In the current version of DD4T the base controller - TridionControllerBase - has a PreviewPage action that would allow you to post DD4T XML to it, returning view markup.
Could find an example TBB - but should be straight-forward to write. There is an example RewriteUrlsForPreview TBB which I think takes care of swapping out Preview urls prior to posting (not quite sure on that one)?
I'm not sure how much of this would apply to DD4T, but I've used a solution like this with similar solutions:
- In your delivery side, make sure the XML input for your pages/components can come from any XML document, not just a file or a database record
- Add a webservice that allows you to POST temporary content to be rendered on the delivery tier, and that invokes your rendering framework
- In your templates, add a building block that determines if you're previewing or publishing
- If previewing, invoke this webservice then show the results of the rendering framework
I don't know how far DD4T goes in allowing for this, so the amount of work needed will vary - maybe others around here can help in the remaining steps.