6

What is the difference between the 2: Engine.PublishingContext.RenderContext.ContextItem and Engine.PublishingContext.ResolvedItem ?

Seems Engine.PublishingContext.ResolvedItem is usually used to get The ComponentTemplate and Engine.PublishingContext.RenderContext.ContextItem gets the Page ( as an example)?

What really is meant by ResolvedItem ? What the term Resolve actually means? aren't the ResolvedItem and ContextItem same?

I have gone through the SDL Live content and the CHMs, but the definitions there didn't help much.

So, What is the difference between RenderedItem , ResolvedItem and ContextItem ?

7

Let's take an example to illustrate these concepts: suppose the user publishes a Structure Group which contains a Page which, in turn, contains an embedded Component Presentation and a Dynamic Component Presentation. This results in a single Publish Transaction for the given Structure Group.

The first thing the Publisher does with a Publish Transaction is resolve the items to render. In this example, there are two Resolved Items: the Page and the Dynamic Component Presentation.

When rendering the Page (i.e. executing the Page Template), the following applies:

Engine.PublishingContext.ResolvedItem = <The Page>
Engine.PublishingContext.RenderContext.ContextItem = null

Typically, the Page Template will let the Render Engine render the Component Presentations on the Page. In general, Component Presentations are rendered separately, but embedded Component Presentations will be rendered in context of the Page:

Engine.PublishingContext.ResolvedItem = <The embedded Component Presentation>
Engine.PublishingContext.RenderContext.ContextItem = <The Page>

Finally, the resolved Dynamic Component Presentation will be rendered. Dynamic Component Presentations are normally rendered stand-alone (even if they are on a Page):

Engine.PublishingContext.ResolvedItem = <The Dynamic Component Presentation>
Engine.PublishingContext.RenderContext.ContextItem = null
| improve this answer | |
  • Ok, Now I understand Context and Resolve things, can you please also comment on what is RenderedItem and if possible give a similar comparison as in above answer ? – R.C Dec 30 '14 at 4:10
  • During preview (in the content manager and in template builder) the ContextItem for the DCP is still the page when previewing the page; I'm assuming this is some special situation where DCPs are rendered statically for preview purpose only... – Bjørn van Dommelen Dec 30 '14 at 12:51
1

RenderedItem represents an item that has been rendered (or is being rendered) and is a construct that holds

  • the resolved item
  • binaries (that have been added to the rendered item using AddBinary from a template)
  • rendered content
  • links to child rendereditems (for example a page will have component presentations as child rendered items)
  • some additional info (see the product documentation for a full listing)

As such the rendered item and resolved item are the same (as far as the Tridion page or component it points to):

engine.PublishingContext.RenderedItem.ResolvedItem == engine.PublishingContext.ResolvedItem

After the publisher has resolved the publish transaction (which yields a set of ResolvedItems) the renderer will generate a RenderedItem for each ResolvedItem. After rendering has successfully completed the rendered items will be transported (content, added binaries, metadata) and deployed.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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