4

I have template code (2011 SP1) which detects if a CMS Preview was being used by checking engine.RenderMode (which would be PreviewDynamic). This would then ensure that stuff that would usually be added by the app server for the published pages (like CSS, JS, navigation elements etc.) is injected to the rendered output so the preview looks nice in the CMS.

The Tridion 2012 UI/XM creates temporary files for dynamic preview, and it turns out that in Publishing these files, the render mode is also PreviewDynamic, which gives me a problem as in the situation when the page is actually published, I don't want to inject stuff (the app server takes care of this with a .NET master page in this case)

Looking at the possible values for RenderMode in the .NET API we have Publish, PreviewStatic, and PreviewDynamic.

So my questions are:

  1. How can I tell the difference between CMS Preview and DYnamic Preview in template code
  2. When (if at all) is the RenderMode PreviewStatic?

1 Answer 1

5

I have a partial solution (for first question). If you use a combination of RenderMode and the engine.PublishingContext.PublicationTarget you can detect CMS Preview vs Dynamic Preview vs Normal Publish:

  • CMS Preview - RenderMode:DynamicPreview PublicationTarget:null
  • Dynamic Preview - RenderMode:DynamicPreview PublicationTarget:not null
  • Normal Publish - RenderMode:Publish PublicationTarget: not null

Stil not sure when PreviewStatic is used though...?

1
  • I have checked and I can't find a situation where the PreciewStatic is used, I even checked in non-compound templates, but is still PreviewDynamic. Will try to figure this out... Oct 18, 2012 at 15:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.