Skip to content
Rob van Oostenrijk edited this page May 15, 2014 · 1 revision

Introduction

The RenderEngine executes a template in the same way the normal TcmPublisher process executes a template. This allows to debug potential differences between a template rendering in the DebugEngine and the RenderEngine separately.

Details

RenderEngine is based on a concept I first saw by Mihai Cădariu on his blog: Messing with the Engine (Credits to him for the idea).

However instead of using the TemplatingRenderer directly as suggested in the blog, this uses the same approach as the TcmPublisher process.

First a normal Tridion session is created:

Session session = new Session();

Then a normal resolved item and its publish instruction is set up:

ResolvedItem resolvedItem = new ResolvedItem(item, template);

PublishInstruction instruction = new PublishInstruction(session)
{
    RenderInstruction = new RenderInstruction(session)
    {
        RenderMode = RenderMode.PreviewDynamic
    },
    ResolveInstruction = new ResolveInstruction(session)
    {
        IncludeChildPublications = false,
        IncludeComponentLinks = true,
        IncludeWorkflow = false,
        OnlyPublishedItems = false,
        Purpose = ResolvePurpose.Publish,
        StructureResolveOption = StructureResolveOption.ItemsAndStructure
    }
};

The created publish instruction is subsequently pushed into the rendering engine:

RenderedItem renderedItem = global::Tridion.ContentManager.Publishing.Rendering.RenderEngine.Render
    (resolvedItem, 
     instruction,
     null);

Clone this wiki locally